Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
berry195
Regular Visitor

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

berry195_1-1715881916410.png

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_2-1715881939233.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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

View solution in original post

2 REPLIES 2
berry195
Regular Visitor

@amitchandak many thanks Sir!

amitchandak
Super User
Super User

@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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.