Forum Discussion
RafalK
Advocate IV
10 years agoRunning Total on a non-date column
Hi guys, I am having some real problems with calculating a running-total in Power BI. Main problem here is that my running total should be based on a calculated measure. Here is the problem: C...
- 10 years ago
Please try with following Calculated Measure for the cumulative sales. It should be able to reduce the calculation.
Cumulative_Sales_Measure = CALCULATE ( SUM ( Table1[Sales] ), FILTER ( ALL(Table1), Table1[Sales] >= MAX ( Table1[Sales] ) ), VALUES ( Table1[Brand] ) )
Regards,
v-sihou-msft
Microsoft Employee
10 years ago
In this scenario, you can rank the sales for each brand first, and then get the cumulative sales according to the rank. Please create two calculated columns with following formulas.
RankInBrand =
RANKX (
FILTER ( Table1, EARLIER ( Table1[Brand] ) = Table1[Brand] ),
Table1[Sales]
)
Cumulative Sales =
SUMX (
FILTER (
Table1,
Table1[RankInBrand] <= EARLIER ( Table1[RankInBrand] )
&& Table1[Brand] = EARLIER ( Table1[Brand] )
),
Table1[Sales]
)
Regards,
vin26
Resolver I
6 years agoThanks a lot for the solution, I was struggling to get the cumulative total