Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I'm trying to do a cumulative sum by group. I've tried different solutions but none seems to work.
I have a table with millions of entries of booking made and they all are grouped by channel group
I was able to create a cumulative sum for the number of nights as in above picture.
The main problem I get is that it does not sum indevidualy per group when all groups are selected. It groups the nights and shows the same value for all.
this is how I'm calculating the cumulative sum
cumulative nights = CALCULATE([nr_nights total for group], FILTER(ALLSELECTED('gc_reports bookings'), 'gc_reports bookings'[book_date].[Date]<= MAX ('gc_reports bookings'[book_date].[Date])))
The nr nights total for group is a quick mesure like this
nr_nights total for group = CALCULATE( SUM('gc_reports bookings'[nr_nights]), ALLSELECTED('gc_reports channel_groups'[group]) )
Once you select a specific group, all works.
Sorry if this is a dumb question but what am I doing wrong here?
Solved! Go to Solution.
@JoaoTrindade here is the measure
cumulative nights = CALCULATE( [total nights], FILTER( ALLSELECTED('gc_reports bookings'[book_date].[Date]), 'gc_reports bookings'[book_date].[Date] <= MAX ('gc_reports bookings'[book_date].[Date]) ) )
also I noticed there is lot of both direction cross filter in your model whcih is a bad idea. anyhow that is seperate topic.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
User | Count |
---|---|
124 | |
108 | |
99 | |
62 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |