Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
Currently I'm using the measure below to calculate my running total sales. This works fine, except;
I would like recalculate the running total for each slicer adjustment. At the moment it starts the total based on latest results, but I would like to start at 0.
For example:
No slicer adjustment (working as intended):
Month | Week | CumSales |
1 | 1 | 100 |
1 | 2 | 200 |
1 | 3 | 300 |
1 | 4 | 400 |
2 | 1 | 450 |
2 | 2 | 500 |
2 | 3 | 550 |
2 | 4 | 600 |
Current results when slicing to month 2 (not intended)
Month | Week | CumSales |
2 | 1 | 450 |
2 | 2 | 500 |
2 | 3 | 550 |
2 | 4 | 600 |
Desired result when slicing to month 2
Month | Week | CumSales |
2 | 1 | 50 |
2 | 2 | 100 |
2 | 3 | 150 |
2 | 4 | 200 |
CumSales =
if(
MIN(Cal[Date]) <= CALCULATE(MAX(Sal[Sales date]); all('Sal'));
CALCULATE(SUM('Sal'[Sales])+0
;FILTER(ALL(Cal[Date]);Cal[Date] <= MAX(Cal[Date])))
)
Solved! Go to Solution.
I think I just found it!
CumSales =
if(
MIN(Cal[Date]) <= CALCULATE(MAX(Sal[Sales date]); all('Sal'));
CALCULATE(SUM('Sal'[Sales])+0
;FILTER(ALLSELECTED(Cal);Cal[Date] <= MAX(Cal[Date])))
)
Note quite following. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Thanks for your feedback Greg. Tried to make it clearer with examples instead of text.
This challenge took my entire day 🙂
I think I just found it!
CumSales =
if(
MIN(Cal[Date]) <= CALCULATE(MAX(Sal[Sales date]); all('Sal'));
CALCULATE(SUM('Sal'[Sales])+0
;FILTER(ALLSELECTED(Cal);Cal[Date] <= MAX(Cal[Date])))
)
Offtopic comment, but you saved my day!!!
Thank you! 🙂
Hi @PVO1
Glad that you've fixed it! please kindly mark it as the answer to help others find it more quickly. thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
80 | |
63 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |