Reputation:
I'm in working on project with goal of connecting multiple banks, in Netherlands, into our platform.
For now, every time a user connects to a single bank, we want to send out a metric and show it in Azure dashboard. We are almost there, except that we want to aggregate the sum per day. This is what we have right now:
For example, looking at ABN AMRO, we have:
But what we want is to sum it like this:
This is the query used so far:
customMetrics
| where name == "CustomerGrantedConsent"
| extend BankName = customDimensions.BankName
| summarize Count = count() by tostring(BankName), bin(timestamp, 1d)
| order by timestamp
How?
Upvotes: 0
Views: 336
Reputation: 10849
Try using row_cumsum
customMetrics
| where name == "CustomerGrantedConsent"
| extend BankName = customDimensions.BankName
| summarize Count = count() by tostring(BankName), bin(timestamp, 1d)
| order by timestamp
| serialize
| extend cumsum = row_cumsum(Count, BankName != prev(BankName))
It will return the output as your require
You can read about the row_cusmum at here.
Upvotes: 0
Reputation: 16208
let T = datatable(day:datetime , value:long)
[
"2021-01-25", 3000,
"2021-01-24", 2000,
"2021-01-23", 1000
];
T
| order by day asc
| serialize cs=row_cumsum(value)
| project day, cs
Upvotes: 0