question

ilyas avatar image
ilyas asked

A simple query in Explorer

Hey guys, I have a custom event like this:

  {"PlayFabEnvironment": {
    "Application": "mainserver",
    "Vertical": "master",
    "Commit": "5ea788d",
    "Cloud": "main"
  },
  "EventNamespace": "title.61DAC",
  "EntityType": "player",
  "SourceType": "GameClient",
  "Timestamp": "2020-04-18T11:53:31.0308461Z",
  "EventName": "levelLog",
  "EntityId": "93E58E63E772BDE",
  "TitleId": "61DAC",
  "EventId": "6de7995f9644448e93fb3f6bf4b9045e",
  "Source": "61DAC",
  "player_id": "93E58E63E772BDE",

  "result": "win",
  "level": 3,
  "hero" : 2,
  "try_count": 5
}
If a player wins a level in the game, this event is sent to PlayFab.
I try to find the percentile 0.25 of try_count for each level and hero selected for this level where result is “win”.
The result will be like this, if we assume there are only 3 levels and 2 heroes in the game:
level hero try_count  

  1     1     1  
  2     1    2.5  
  3     1     8
  
  1     2     2  
  2     2    1.5    
  3     2     6
I tried my best but couldn’t get this query right. Could you please help me in this situation?Thanks in advance,Cagatay
dataanalytics
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

·
Citrus Yan avatar image
Citrus Yan answered

There is no need to search for events where result is “win” since events are sent when player wins a level, we can assume that “levelLog” events always have “win” as the result. Therefore, according to your description, the following query should meet your requirements:

let data = 
['events.all'] 
| where FullName_Name == "levelLog" 
| project  toint(EventData.level) , toint(EventData.hero), toint(EventData.try_count);
data
| summarize  percentiles(EventData_try_count,25) by  EventData_level, EventData_hero
| project-rename  hero = EventData_hero, level = EventData_level, try_count = percentile_EventData_try_count_25
| sort by hero asc, level asc

By the way, you may find this Kusto Query Tutorial helpful for writing queries: https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/tutorial

1 comment
10 |1200

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

ilyas avatar image ilyas commented ·

Thanks you very much

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.