Forum Discussion
Rolling sum based on sorted column
Hi, Anonymous
I tested it. It is best to use the calculation column for rolling summation. If the Ticket Qty is measure, the Ticket Qty cannot be referenced.
If Ticket Qty is a calculated column.
Rank =
RANKX ( 'Table', 'Table'[Ticket Qty], [Ticket Qty], DESC )
Rolling Sum =
CALCULATE (
SUM ( 'Table'[Ticket Qty] ),
FILTER ( ALL ( 'Table' ), [Rank] <= EARLIER ( 'Table'[Rank] ) )
)
Rolling Sum Measure =
CALCULATE (
SUM ( 'Table'[Ticket Qty] ),
FILTER ( ALL ( 'Table' ), [Rank] <= MAX ( 'Table'[Rank] ) )
)
If my method can't solve your problem. If Ticket Qty can only be measure, can you provide the source data of Ticket Qty and I'll test it again? Thank you.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
Hi v-zhangti,
You are right Tickets Quantity cannot be referenced if it is a calculated measure and I tried the same logic in a calculated column but it gives me wrong results.
DAX:Tickets Quantity =
Calculate(SUM('Transaction'[Item Count]),FILTER(ALLSELECTED('Item Type'),[Item Type]="Ticket"))Here is the link to the Ticket Qty sample source data (excel) file.
https://docs.google.com/spreadsheets/d/1eIA2Abarbkl4nXhvtA7gz3hIExB5j13o/edit?usp=sharing&ouid=113177030674399990149&rtpof=true&sd=truePlease let me know if you need any more fields data or information.
- v-zhangti4 years ago
Community Support
Hi, Anonymous
Thank you for your reply.
You also need to tell me how you got the table below:
VenueCity Item Type Tickets Quantity Boston Ticket 442393 West Palm Beach Ticket 80257 Raleigh Ticket 28927 National Harbor Ticket 21212 New York Ticket 546 Because the field "ventuecity" does not appear in the data you provided.
Look forward to your reply.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
Hi v-zhangti,
Please find the updated excel here with both the Transaction table (has Item Count) and Performance table (has VenueCity) joined on Performance Key (Many to One)
https://docs.google.com/spreadsheets/d/1nDnBezke6IbbfvY_GxcSeDcHhSaLEmN9/edit?usp=sharing&ouid=113177030674399990149&rtpof=true&sd=true
Thanks