Forum Discussion
Slicer selection changes the cumulative total
Hi All,
I have a measure which calculates cumulative loss over development years (which is also a measure based on start year and performance month). I used the following the DAX to calculate AnnualDevelopmenDisplay (calcualted from Annual Development) and the CumulativeNetCollateralLoss.
Slicer unselectedSlicer selected
| DimDeal.StartDate | DealID | PerformanceMonth | CreditEventNetLossAmount |
| 2/26/2014 | 32 | 3/1/2014 | 0 |
| 2/26/2014 | 32 | 4/1/2014 | 0 |
| 2/26/2014 | 32 | 5/1/2014 | 0 |
| 2/26/2014 | 32 | 6/1/2014 | 0 |
| 2/26/2014 | 32 | 7/1/2014 | 61806 |
| 2/26/2014 | 32 | 8/1/2014 | 12534 |
| 2/26/2014 | 32 | 9/1/2014 | 93461 |
| 2/26/2014 | 32 | 10/1/2014 | 174623 |
| 2/26/2014 | 32 | 11/1/2014 | 119235 |
| 2/26/2014 | 32 | 12/1/2014 | 177913 |
| 2/26/2014 | 32 | 1/1/2015 | 81489 |
| 2/26/2014 | 32 | 2/1/2015 | 249500 |
| 2/26/2014 | 32 | 3/1/2015 | 88451 |
| 2/26/2014 | 32 | 4/1/2015 | 116480 |
| 2/26/2014 | 32 | 5/1/2015 | 91149 |
| 2/26/2014 | 32 | 6/1/2015 | 223681 |
| 2/26/2014 | 32 | 7/1/2015 | 20611 |
| 2/26/2014 | 32 | 8/1/2015 | 107788 |
| 2/26/2014 | 32 | 9/1/2015 | 219877 |
| 2/26/2014 | 32 | 10/1/2015 | 65134 |
| 2/26/2014 | 32 | 11/1/2015 | 176428 |
| 2/26/2014 | 32 | 12/1/2015 | 194564 |
| 2/26/2014 | 32 | 1/1/2016 | 276480 |
| 2/26/2014 | 32 | 2/1/2016 | 205944 |
| 2/26/2014 | 32 | 3/1/2016 | 370500 |
| 2/26/2014 | 32 | 4/1/2016 | 51543 |
| 2/26/2014 | 32 | 5/1/2016 | 169476 |
| 2/26/2014 | 32 | 6/1/2016 | 268503 |
| 2/26/2014 | 32 | 7/1/2016 | 328455 |
| 2/26/2014 | 32 | 8/1/2016 | 216249 |
| 2/26/2014 | 32 | 9/1/2016 | 186896 |
| 2/26/2014 | 32 | 10/1/2016 | 279587 |
| 2/26/2014 | 32 | 11/1/2016 | 220184 |
| 2/26/2014 | 32 | 12/1/2016 | 203915 |
| 2/26/2014 | 32 | 1/1/2017 | 150670 |
| 2/26/2014 | 32 | 2/1/2017 | 344587 |
| 2/26/2014 | 32 | 3/1/2017 | 443104 |
| 2/26/2014 | 32 | 4/1/2017 | 176915 |
| 2/26/2014 | 32 | 5/1/2017 | 195982 |
| 2/26/2014 | 32 | 6/1/2017 | 155957 |
| 2/26/2014 | 32 | 7/1/2017 | 130947 |
| 2/26/2014 | 32 | 8/1/2017 | 253935 |
| 2/26/2014 | 32 | 9/1/2017 | 167044 |
| 2/26/2014 | 32 | 10/1/2017 | 271076 |
| 2/26/2014 | 32 | 11/1/2017 | 239677 |
| 2/26/2014 | 32 | 12/1/2017 | 190364 |
| 2/26/2014 | 32 | 1/1/2018 | 258930 |
| 2/26/2014 | 32 | 2/1/2018 | 138391 |
| 2/26/2014 | 32 | 3/1/2018 | 162087 |
| 2/26/2014 | 32 | 4/1/2018 | 475329 |
| 2/26/2014 | 32 | 5/1/2018 | 513233 |
| 2/26/2014 | 32 | 6/1/2018 | 173594 |
| 2/26/2014 | 32 | 7/1/2018 | 261316 |
| 2/26/2014 | 32 | 8/1/2018 | 182793 |
| 2/26/2014 | 32 | 9/1/2018 | 117470 |
| 2/26/2014 | 32 | 10/1/2018 | 117017 |
| 2/26/2014 | 32 | 11/1/2018 | 261685 |
| 2/26/2014 | 32 | 12/1/2018 | 153336 |
hi, Anonymous
I have use this formula to tested in directquery, it works well
CALCULATE(SUM('Import for sample Market Risk'[CreditEventNetLossAmount]),FILTER(ALL('Import for sample Market Risk'[DevelopmentAnnualDisplay]),ISONORAFTER([DevelopmentAnnualDisplay],Max([DevelopmentAnnualDisplay]))))and this formula shouldn't have the limitation in directqueryIf you could try this formula:CALCULATE(SUM('Import for sample Market Risk'[CreditEventNetLossAmount]),FILTER(ALL('Import for sample Market Risk'),'Import for sample Market Risk'[DevelopmentAnnualDisplay]>=MIN('Import for sample Market Risk'[DevelopmentAnnualDisplay])))orCALCULATE(SUM('Import for sample Market Risk'[CreditEventNetLossAmount]),FILTER(ALL('Import for sample Market Risk'[DevelopmentAnnualDisplay]),'Import for sample Market Risk'[DevelopmentAnnualDisplay]>=MIN('Import for sample Market Risk'[DevelopmentAnnualDisplay])))And if still has the problem, please check that when change directquery to import in power bi desktop, it will work.In the lower right corner of power bi desktop, then click as below:Best Regards,
Lin
9 Replies
- Greg_Deckler
Community Champion
Sample data would help tremendously. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- v-lili6-msft
Community Support
hi, Anonymous
Just use ALL instead of ALLSELECTED for the cumulative total measure.
Measure = CALCULATE ( SUM ( FactCRTLoanPerformanceMonth[CreditEventNetLossAmount] ), FILTER ( ALL ( FactCRTLoanPerformanceMonth[AnnualDevelopmentDisplay] ), ISONORAFTER ( FactCRTLoanPerformanceMonth[AnnualDevelopmentDisplay], MAX ( FactCRTLoanPerformanceMonth[AnnualDevelopmentDisplay] ), DESC ) ) )Result:
Best Regards,
Lin
- AnonymousNot applicable
HI v-lili6-msft
Thank you very much for replying, I tried using ALL as you suggested below. Unfortunately, it's still not working in my case. I am attaching the screenshots here for results with the measure as per your instruction and my previous measure.Without slicer selectionWith Slicer Selection
- AnonymousNot applicable
Please let me kow if there is any other workaround to get that cumulative number at the end of the each year (cumulative value carried forward to the next year from the previous year). I have tried to use one more measure (CumulativeLosses, DAX below) which is based on perfromance month not the annualDevelopmentDisplay. It shows the the right cumulative values but my next step would be to just get the cumulative value at the end of each year (December values, as highlighted in the image below).
CumulativeLosses =CALCULATE(SUM(FactCRTLoanPerformanceMonth[CreditEventNetLossAmount]),filter(ALL(FactCRTLoanPerformanceMonth[PerformanceMonth]),FactCRTLoanPerformanceMonth[PerformanceMonth]<=max(FactCRTLoanPerformanceMonth[PerformanceMonth])))