question

Max Guernsey, III avatar image
Max Guernsey, III asked

KQL Query that partitions by experimental variant?

I'm executing my first experiment and I want to evaluate the results based on data other than the analyses offered out of the box. Is there a way to create a KQL query that groups events under the applicable experimental variation assignment?

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

For example, you can refer to the following Kusto statement to list the events under the "xxxxx" variant.

['events.all'] | where EventData.ExperimentVariants[0] == "xxxxx"

You can navigate to [Game Manager]->[Data]->[Event History] to check the JSON of every event. As shown above, the variables in the event JSON can be used in the Kusto statement. Please let us know if you have other exact requirements for the query.

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.

Max Guernsey, III avatar image Max Guernsey, III commented ·

Perfect. Thanks.

0 Likes 0 ·
Max Guernsey, III avatar image
Max Guernsey, III answered

I'm adding this answer to give a more detailed explanation to anyone who wants it. @Sarah Zhang's answer will remain the accepted one because that was the kernel of information I needed.

I was trying to create a Net Promoter Score scorecard-like-thing. Here's what I landed onL

['events.all']
// start by getting the experiment assignments
| where FullName_Name == 'player_experiment_variants_changed'
// explode out all variants
| mv-expand Variant = EventData.ExperimentVariants
// Convert the variant to a string... not sure why it's not already one but it isn't
| extend Variant = tostring(Variant)
// we only want new assignments of variants
| where not (EventData.PreviousExperimentVariants has Variant)
// filter out assignments that don't include the variants you actually care about
| where Variant in ('5cc4a1', '812d15','4f2124')
// limit the information to what you need
| project Entity_Id, Variant, ExperimentTimestamp=Timestamp
// join in the customer feedback
| join (['events.all'] | where FullName_Name == 'player_report_experience') on Entity_Id
// exclude feedback that can't be part of the experiment
| where ExperimentTimestamp <= Timestamp
// cherry-pick the data you need
| project Variant, Level = EventData.Level
// create the summary
| summarize Detractors = countif(Level  < 1), Promoters=countif(Level > 1), Total=count() by Variant
// perform the final analysis
| project Variant, NetPromoterScore = 100 * (Promoters - Detractors) / Total

Obviously, that won't work for you unadapted, but it shouldn't be too hard to swap in your own values and data structures.

10 |1200

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

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.