Forum Discussion

berry195's avatar
berry195
Frequent Visitor
2 years ago
Solved

Filter() and AllSelected()

Hello, I want to to write a formula to calculate Running Total based on slicer. Nevertheless, I do not understand why one formula works, but the other one (which should be working) does not. Could someone help explain! Many thanks!!

This is the snipset for the correct one

Running Total =
Var _CurrrentMAX = Max('Date'[Date])
VAR RT = CALCULATE([Sales Amount],filter(ALLSELECTED('Date'),'Date'[Date] <= _CurrrentMAX))
Return RT

And this is for the wrong one

Running Total Wrong =
Var _CurrrentMAX = Max('Date'[Date])
VAR RT = CALCULATE([Sales Amount],'Date'[Date] <= _CurrrentMAX,ALLSELECTED('Date'))
Return RT

 

  • berry195 , when you have used Date in the filter section of calculate, without using the filter function, it has already considered all(Date[Date])

     

    so it is considering the dates which are not selected too

     

    refer: Difference in filtering data in CALCULATE with and without FILTER - https://youtu.be/KDcmzwgPvXQ

2 Replies

  • berry195 , when you have used Date in the filter section of calculate, without using the filter function, it has already considered all(Date[Date])

     

    so it is considering the dates which are not selected too

     

    refer: Difference in filtering data in CALCULATE with and without FILTER - https://youtu.be/KDcmzwgPvXQ