I have a query to find out the distinct user Ids and their country, agency name, city code who use a specific product version. How do I list the properties successfully? Below query doesn't have filter out the unique users.
customEvents | where customDimensions.["Product Version"] == "7.4" | where timestamp between(datetime("2018-12-01T00:00:00.000Z")..datetime("2018-12-02T00:00:00.000Z")) | project client_CountryOrRegion, user_Id, customDimensions.["Agency Name"], customDimensions.["Pseudo City Code"], customDimensions.["Product Version"]
Re: kql query for distinct values If that is not an issue then after you get your host and your displayName, you can concatenate (using the strcat command) and then perform another distinct on the concatenated string. Hope this is what you are looking for.
update:
Please use alias when use tostring() method. And then in the project command, use the alias instead of the column name.
See my test result as below:
Before the project syntax, please use summarize count() by client_CountryOrRegion, user_Id, customDimensions.["Agency Name"], customDimensions.["Pseudo City Code"], customDimensions.["Product Version"]
, then use project to output the properties your like.
Completed code like below:
customEvents
| where customDimensions.["Product Version"] == "7.4"
| where timestamp between(datetime("2018-12-01T00:00:00.000Z")..datetime("2018-12-02T00:00:00.000Z"))
| summarize count() by client_CountryOrRegion, user_Id, customDimensions.["Agency Name"], customDimensions.["Pseudo City Code"], customDimensions.["Product Version"]
| project client_CountryOrRegion, user_Id, customDimensions.["Agency Name"], customDimensions.["Pseudo City Code"], customDimensions.["Product Version"]
Please let me if any issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With