question

choi dong geun avatar image
choi dong geun asked

How do I find the highest values for multiple users?(kql)

hi.

I'm using kql for log management.


What I want to know is that I want to find and sort the max value of each user among the various user's data


In this case, which command should I use?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Made Wang avatar image
Made Wang answered

You can use the sort command, refer to Write queries for Azure Data Explorer | Microsoft Docs and the examples below.

['events.all'] 
| where FullName_Name == "player_virtual_currency_balance_changed"
| sort by  tostring(EventData.VirtualCurrencyBalance)  desc 
| project  Entity_Id,EventData.VirtualCurrencyBalance

If the user' data you say refers to Player Data, then it should be noted that no events are automatically generated when the data in Player Data is updated. You need to manually generate events for data updates via WritePlayerEvent so that you can query the data in the Data Explorer (advanced).

Also, for player data that needs to be sorted, you may consider using statistics and leaderboards.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

choi dong geun avatar image choi dong geun commented ·

Is there any way to find the data without overlapping the entity_id does not overlap?
I thought it was distinct, but I don't think it is

0 Likes 0 ·
Made Wang avatar image Made Wang choi dong geun commented ·

You can try summarize.

['events.all'] 
| where FullName_Name == "player_virtual_currency_balance_changed"
| sort by  Entity_Id,tostring(EventData.VirtualCurrencyBalance)  desc 
| project  Entity_Id,EventData.VirtualCurrencyBalance
| summarize  arg_max(tostring(EventData_VirtualCurrencyBalance),*) by Entity_Id

Also, I'm not an expert on Kusto, for more advanced queries, please refer to Kusto documentation.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.