Forum Discussion
DAX Cumulative Total and Cumulative %
- 6 years ago
Just change the measure to this
Count:=COUNTROWS(RawData)
Anonymous ,
Thanks for tag, I enjoy working on fun stuff, as long as I can get a pbix, or copy and paste the data into Power Query!
Below is the crux of the code. Hopefully I understood your issue, and what you were looking for as an output. You could fine tune this by using the date time as well.
Here is my pbix file:Delivery percentage
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Cumulative % =
VAR _currentDay =
MAX ( Del[No of Days to Deliver] )
VAR _calc =
CALCULATE ( [Count All], Del[No of Days To Deliver] <= _currentDay )
RETURN
_calcalong with this.
Count All no really = CALCULATE(COUNT(Del[No of Days To Deliver]),ALL(Del))
The interesting part is that we use the count when we are filtering against the number of days it takes to deliver, but we use Count ALL, no really when we really want the total to not filter against the days, as it is the total.
Nathaniel_C thank you but unfortunately when applying this to my data model, it doesn't work as intended. It looks correct from your end but not mine. Note: I'm using PowerPivot/PowerQuery in Excel, not PowerBi app so I couldn't open your pbix file.
1. in comparison to my existing DAX measure, the output is not the same as per screenshot below i.e. cumulative total is not the same
2. cumulative % - shouldn't this be 100%?
I've manually double/triple checked my existing DAX measure and I'm confident it works but its just the cumulative % that is not correct i.e. it's showing % delivered by day instead of % cumulative delivered by day
Just to clarify how I use this measure(my existing DAX measure) in pivot table, here is screenshot (by Month) below, I know the measure is correct when I manually sum the % figures of first 3 days for Oct, the sum is 76% delivered on Day 3 which is correct. However, the correct DAX formula should output 76% in Day 3 instead of 36%
- Nathaniel_C6 years ago
Community Champion
Hi Anonymous ,
So not sure that I am reading this right, but do you average the weeks for the month?
- Anonymous6 years agoNot applicable
No average, I did a manual SUM as a check for my existing measure. The [Delivery] column is a date field which I have linked to a calendar table which I use to break down the dates by day, week, month, etc
- Nathaniel_C6 years ago
Community Champion
Hi Anonymous ,
So, here is the EXCEL File. Cumulative Hopefully you can look at that and it will be a tool to figure it out. Or maybe you can duplicate the measures, using your own table. This table is the one that you posted for me.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel