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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Robin96
Helper II
Helper II

DAX calculation with slicer values

Hey guys, i have a small questions regarding a DAX measure.

My goal is to have my last measure "Above or below"  in the visual to show "Equal or below" on the first selected week, and above on the rest. like i have screenshotted under. But when i select a week higher then 1, its not working.

Robin96_0-1708673793328.png


This is my measure right now:
IF_TEST = IF(MIN('Dimension Date'[Week Number])>CALCULATE(MIN('Dimension Date'[Week Number]), REMOVEFILTERS('Dimension Date'[Week Number])),"Above","Equal or below")

It do seem that my REMOVEFILTERS removes the slicers i have selected and gives the lowest output. But i want my slicers to work.

Any suggestions?

1 ACCEPTED SOLUTION
jolind1996
Resolver II
Resolver II

It seems like you’re trying to retain the slicer selection while evaluating the minimum week number. Consider using the ALLSELECTED function instead of REMOVEFILTERS to respect the slicer’s context. Modify your DAX measure as follows: IF_TEST = IF(MIN('Dimension Date'[Week Number]) > CALCULATE(MIN('Dimension Date'[Week Number]), ALLSELECTED('Dimension Date'[Week Number])), "Above", "Equal or below"). This should give you the desired output based on your slicer selection. Remember, ALLSELECTED respects the filters applied by slicers, unlike REMOVEFILTERS which ignores all filters.

 

Best regards,

Johannes

View solution in original post

2 REPLIES 2
jolind1996
Resolver II
Resolver II

It seems like you’re trying to retain the slicer selection while evaluating the minimum week number. Consider using the ALLSELECTED function instead of REMOVEFILTERS to respect the slicer’s context. Modify your DAX measure as follows: IF_TEST = IF(MIN('Dimension Date'[Week Number]) > CALCULATE(MIN('Dimension Date'[Week Number]), ALLSELECTED('Dimension Date'[Week Number])), "Above", "Equal or below"). This should give you the desired output based on your slicer selection. Remember, ALLSELECTED respects the filters applied by slicers, unlike REMOVEFILTERS which ignores all filters.

 

Best regards,

Johannes

Hey Johannes,

This did work perfectly! Thank you so much for the help!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.