Search code examples
azure-application-insights

Application Insights aggregate sums of event occurrences


I'm logging an event UserRegistered in app insights so that I can see which users have done what right from registration. I'd like to use this event to also display total users registered over time.

I currently have this query:

customEvents
| where timestamp >= datetime(2021-06-04T16:08:10.602Z) and timestamp < datetime(2021-06-11T16:08:10.602Z)
| summarize ['customEvents/count_sum'] = sum(itemCount) by bin(timestamp, 1d)
| order by timestamp desc

However this only gives me the total of each bin. So if a user registers on day 1 and two on day 3, I see something like:


                     |
|                    |
1         2          3

However, I want to see growth over time, so these bins would need to aggregate their sums, giving me this:

                     |
                     |
|         |          |
1         2          3

Can I achieve this in App Insights?


Solution

  • try this ?

    customEvents
    | where timestamp >= datetime(2021-06-04T16:08:10.602Z) and timestamp < datetime(2021-06-11T16:08:10.602Z)
    | summarize ['customEvents/count_sum'] = sum(itemCount) by bin(timestamp, 1d)
    | order by timestamp desc
    | extend total=row_cumsum(['customEvents/count_sum'])