Power BI calculate DAX measure cumulatively
Problem Description:
I can’t configure how to calculate DAX measure cumulatively. The DAX measure by it self looks like this:
UpdateTicket_ = CALCULATE(Logging[LogDistcount_], Logging[Step] = 7) # DAX measure to filter distinct ID by some condition.
LogDistcount_ = DISTINCTCOUNT(Logging[TicketId]) # DAX measure to calculate distinct ID presented in the featured dataset.
The ploblem is that formula construction to calculate cumulatively doesn’t allow to sum DAX measure. I mean this: =CALCULATE(SUM(UpdateTicket_)… The formula doesn’t give an option to select UpdateTicket_ to make a SUM of it. This measure doesn’t appear in the selection list of the SUM formula at all.
Currently output of the UpdateTicket_ measure looks like this:
StartTime_DateOnly | UpdateTicket_ |
---|---|
08.11.2022 | 950 |
09.11.2022 | 1056 |
10.11.2022 | 1056 |
11.11.2022 | 1056 |
12.11.2022 | 1056 |
13.11.2022 | 1056 |
What I am looking for:
StartTime_DateOnly | UpdateTicket_ | UpdateTicket_Cumulatively |
---|---|---|
08.11.2022 | 950 | 950 |
09.11.2022 | 1056 | 2006 |
10.11.2022 | 1056 | 3062 |
11.11.2022 | 1056 | 4118 |
12.11.2022 | 1056 | 5174 |
13.11.2022 | 1056 | 6230 |
Solution – 1
I hope you can accept the following solution:
Let Power BI create the measure for you by going to Quick measure – Running total
You’ll get the following expression:
UpdateTicket_Cumulatively =
CALCULATE(
SUM('Table'[UpdateTicket_]),
FILTER(
ALLSELECTED('Table'[StartTime_DateOnly]),
ISONORAFTER('Table'[StartTime_DateOnly], MAX('Table'[StartTime_DateOnly]), DESC)
)
and a table like this:
Note that this works with both measures and columns.