Forum Discussion
Rolling SUm
Hi,
I have some issue in calculating the rolling Sum
| Jan | 1 |
| feb | 2 |
| Mar | 3 |
| Apr | 4 |
| May | 5 |
i need dynamic cummulative total based on slicer (Month) selection
for example if Feb and mar are selected then the result should be
| Feb | 2 |
| Mar | 5 |
If mar and may are selected then the result should be
| Mar | 3 |
| May | 8 |
Thanks in Advance
- Anonymous3 years ago
Hi Anonymous ,
Try to create the following measure.
Measure = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Date]<=MAX('Table'[Date])))Sample data is as follows. A date field is required.
Below are the results.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- Greg_Deckler
Community Champion
Anonymous Do you have any other columns like an Index or Date? If so you could do this:
Measure = VAR __Table = ADDCOLUMNS( 'Table', "Rolling", SUMX(FILTER(ALLSELECTED('Table',[Index]<=EARLIER('Table'[Index])),[Value]) ) VAR __Result = SUMX(__Table,[Rolling]) RETURN __Result - Ashish_Mathur
Super User
Hi,
Do you have a proper Data column? If not, then do you have a year column - I will build the Date from the Month and year columns.
- AnonymousNot applicable
Hi Anonymous ,
Try to create the following measure.
Measure = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Date]<=MAX('Table'[Date])))Sample data is as follows. A date field is required.
Below are the results.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.