Forum Discussion
Anonymous
8 years agoNot applicable
Rolling sum
Hi, I am looking at creating a total sum per month as below in the Running Total. Year Region Cat Category MONTH Savings Running Total 2018 A XX Services ...
- 8 years ago
Anonymous
Try this as a MEASURE
Running_Total = CALCULATE ( SUM ( Targets[Savings] ), FILTER ( ALLEXCEPT ( Targets, Targets[Category] ), Targets[Date] <= SELECTEDVALUE ( Targets[Date] ) ) )or this as a CALCULATED COLUMN
Running_Total = CALCULATE ( SUM ( Targets[Savings] ), FILTER ( ALLEXCEPT ( Targets, Targets[Category] ), Targets[Date] <= EARLIER ( Targets[Date] ) ) ) - 8 years ago
Anonymous
I think that whatever Column you use as a slicer would need to be part of ALLEXCEPT function. For example if you use region as a SLICER
Then Measure would be
Running_Total = CALCULATE ( SUM ( Targets[Savings] ), FILTER ( ALLEXCEPT ( Targets, Targets[Category] ,Targets[Region]), Targets[Date] <= SELECTEDVALUE ( Targets[Date] ) ) )
Anonymous
8 years agoNot applicable
Arr yes but in my whole dataset it is a little different, I have an update example of what could happen.
As you can see from below Region Cat and Category can be different the was luck that Region Cat and Category lined up :(
That is why the sum always looked correct.
| Year | Region | Cat | Category | MONTH | Savings | Running Total |
| 2018 | A | XX | Services | January | 50 | 50 |
| 2018 | A | XX | Services | February | 65 | 115 |
| 2018 | B | ZZ | Services | March | 45 | 160 |
| 2018 | A | YY | Retail | January | 21 | 21 |
| 2019 | B | XX | Retail | February | 45 | 66 |
| 2018 | B | YY | Retail | March | 23 | 89 |
| 2018 | B | ZZ | Equipment | January | 12 | 12 |
| 2018 | C | ZZ | Equipment | February | 55 | 67 |
| 2019 | C | YY | Equipment | March | 66 | 133 |
Anonymous
8 years agoNot applicable
Adding to that I am using lots of slicers just the normal oob ones but Cat,Month,category etc..