Forum Discussion
ankasani
Microsoft
Feb 15, 2023How to use multiple sliding_window_counts in a single query
Hi Team, I am using a query like below
let Start = startofday(ago(60d));
let End = startofday(now());
let window=30d; //MAU 30d, WAU 7d, DAU 1d
let bin = 1d;
customEvents
| where timestamp >= Start and timestamp <= End
| project user_Id, timestamp
| evaluate sliding_window_counts(user_Id, timestamp, Start, End, window, bin)
| project timestamp, mau=Dcount
| render timechart
In this query the value will change for window 30d for monthly active users, 7d for weekly active users, 1d for daily active users.
I want to print all these 3 generated graphs in a single window it self. is it possible ?
ankasani , you can try something like this
let Start = startofday(ago(60d)); let End = startofday(now()); let MAUwindow=30d; //MAU 30d, WAU 7d, DAU 1d let WAUwindow=7d; let DAUwindow=1d; let bin = 1d; let filteredEvents= materialize (customEvents | where timestamp >= Start and timestamp <= End | project user_Id, timestamp); let MAUcounts=filteredEvents | evaluate sliding_window_counts(user_Id, timestamp, Start, End, MAUwindow, bin) | project timestamp, mau=Dcount; let WAUcounts=filteredEvents | evaluate sliding_window_counts(user_Id, timestamp, Start, End, WAUwindow, bin) | project timestamp, wau=Dcount; let DAUcounts=filteredEvents | evaluate sliding_window_counts(user_Id, timestamp, Start, End, DAUwindow, bin) | project timestamp, dau=Dcount; MAUcounts | join kind=inner WAUcounts on timestamp | join kind=inner DAUcounts on timestamp | project timestamp, mau, wau, dau | render timechart with (ysplit=panels)
2 Replies
Sort By
- SuryaJ
Microsoft
ankasani , you can try something like this
let Start = startofday(ago(60d)); let End = startofday(now()); let MAUwindow=30d; //MAU 30d, WAU 7d, DAU 1d let WAUwindow=7d; let DAUwindow=1d; let bin = 1d; let filteredEvents= materialize (customEvents | where timestamp >= Start and timestamp <= End | project user_Id, timestamp); let MAUcounts=filteredEvents | evaluate sliding_window_counts(user_Id, timestamp, Start, End, MAUwindow, bin) | project timestamp, mau=Dcount; let WAUcounts=filteredEvents | evaluate sliding_window_counts(user_Id, timestamp, Start, End, WAUwindow, bin) | project timestamp, wau=Dcount; let DAUcounts=filteredEvents | evaluate sliding_window_counts(user_Id, timestamp, Start, End, DAUwindow, bin) | project timestamp, dau=Dcount; MAUcounts | join kind=inner WAUcounts on timestamp | join kind=inner DAUcounts on timestamp | project timestamp, mau, wau, dau | render timechart with (ysplit=panels)