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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
ecmsev
New Member

If and Slicer filters

Hi all,

 

I would like to use an IF function and not apply a measure and get blank if one or two of the slicers have filters selected.

 

How could I do that?

 

Best regards

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @ecmsev ,

 

One sample for your reference, here I create a measure using HASONEVALUE to work on it.

Measure = 
VAR A =
    HASONEVALUE ( Table1[SLICER1] )
VAR B =
    HASONEVALUE ( Table2[SLICER2] )
RETURN
    IF (
        A = TRUE ()
            && B = TRUE (),
        MAX ( Table1[SLICER1] ) - MAX ( Table2[SLICER2] ),
        0
    )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @ecmsev ,

 

One sample for your reference, here I create a measure using HASONEVALUE to work on it.

Measure = 
VAR A =
    HASONEVALUE ( Table1[SLICER1] )
VAR B =
    HASONEVALUE ( Table2[SLICER2] )
RETURN
    IF (
        A = TRUE ()
            && B = TRUE (),
        MAX ( Table1[SLICER1] ) - MAX ( Table2[SLICER2] ),
        0
    )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
stretcharm
Memorable Member
Memorable Member

take a look at selectedvalue and hasonevalue dax functions

 

there are several videos showing how this works e.g.

https://www.youtube.com/watch?v=FI1_N-imBxI

Thanks a lot for your answer,

 

¿Is it possible to create two measures with ISFILTERED()*1 for each slicer and after use both in the IF function?

 

IF(Measure1+Measure2)>=2;"0";column1-column2)

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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