Reputation: 482
I have the following data in a customMetrics
table:
| date | customDimension | Type | value |
| -----------------------------------------------------|
| 01-03-2021 | {"customer":"a"} | Transactions | 12 |
| 01-03-2021 | {"customer":"a"} | Value | 784 |
| 01-03-2021 | {"customer":"c"} | Transactions | 733 |
| 01-03-2021 | {"customer":"b"} | Transactions | 7 |
| 01-03-2021 | {"customer":"c"} | Value | 5 |
| 01-03-2021 | {"customer":"b"} | Value | 85 |
| 01-03-2021 | {"customer":"a"} | Transactions | 50 |
| 01-03-2021 | {"customer":"a"} | Value | 73 |
| 01-03-2021 | {"customer":"c"} | Value | 3 |
| 01-03-2021 | {"customer":"a"} | Transactions | 13 |
| 01-03-2021 | {"customer":"a"} | Value | 237 |
| 01-03-2021 | {"customer":"c"} | Transactions | 3 |
| 01-03-2021 | {"customer":"b"} | Transactions | 575 |
| 01-03-2021 | {"customer":"b"} | Value | 85 |
| 01-03-2021 | {"customer":"b"} | Transactions | 43 |
| 01-03-2021 | {"customer":"b"} | Value | 85 |
| 01-03-2021 | {"customer":"c"} | Value | 789 |
I'm trying to write a query that will find for each customer the max of each value of each type, e.g. something like:
| date | customer | Type | value |
| ---------------------------------------------|
| 01-03-2021 | a | Transactions | 50 |
| 01-03-2021 | a | Value | 784 |
| 01-03-2021 | b | Transactions | 575 |
| 01-03-2021 | b | Value | 85 |
| 01-03-2021 | c | Transactions | 733 |
| 01-03-2021 | c | Value | 789 |
I'm struggling to know what concept in kusto to search for to do this sort of operation. I can get a distinct list of customers and a distinct list of types, but I'm not sure how to combine the two, or if that's even what I should be doing!
Any clues would be helpful!
Upvotes: 2
Views: 920