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
kkalyanrr
Helper V
Helper V

Displaying Value based on two filters ( only when one of them is ON)

Hello,

 

I'm planning to set up a summary chart, where in Summary Value should be presented by either Date Range Selection or Year selection.

 

The chart should display values only if any of the slicer selected(like in the screenshot2),  And should be Set to Blank(unlike in screenshot 1) if both the slicers selected..


Can we do this?Q2.PNG

Q1.PNG

Thanks.

3 REPLIES 3
v-caliao-msft
Microsoft Employee
Microsoft Employee

@kkalyanrr,

 

If you want to show blank in your visual before any items were selected in your slicers. You could create another date table, use the date and year on your slicer. And then create a measure in your original table.

Measure 2 =
VAR selectedyear =
    MAX ( 'Table'[Year] )
VAR selectedmindate =
    MIN ( 'Table'[Date] )
VAR selectedmaxdate =
    MAX ( 'Table'[Date] )
RETURN
    IF (
        ISFILTERED ( 'Table'[Year] ) || ISFILTERED ( 'Table'[Date] ),
        IF (
            MAX ( Sales[Year] ) = selectedyear
                && (
                    MAX ( Sales[Date] ) >= selectedmindate
                        && MAX ( Sales[Date] ) <= selectedmaxdate
                ),
            1,
            0
        ),
        0
    )

Use this measure in your visual filter.
Capture.PNGCapture1.PNGCapture2.PNG

 

Regards,

Charlie Liao

Hello @v-caliao-msft ,

 

Thanks for the reply..

 

The model you've suggested also have the simmilar problem I'm facing. 

 

As I mentioned in my earlier post, the output value should be NULL/BLANK if we select both the slicers. We should have the value only if either of the slicers selected not the both.

 

Q1.PNG

@kkalyanrr,

 

Please try the DAX below.

Measure 2 =
VAR selectedyear =
    MAX ( 'Table'[Year] )
VAR selectedmindate =
    MIN ( 'Table'[Date] )
VAR selectedmaxdate =
    MAX ( 'Table'[Date] )
RETURN
    IF (
        (
            ( ISFILTERED ( 'Table'[Year] ) && ISFILTERED ( 'Table'[Date] ) )
                = TRUE ()
        )
            || (
                ( ISFILTERED ( 'Table'[Year] ) || ISFILTERED ( 'Table'[Date] ) )
                    = FALSE ()
            ),
        0,
        IF (
            ISFILTERED ( 'Table'[Year] ) = TRUE ()
                && ISFILTERED ( 'Table'[Date] ) = FALSE ()
                && MAX ( Sales[Year] ) = selectedyear,
            1,
            IF (
                ISFILTERED ( 'Table'[Year] ) = FALSE ()
                    && ISFILTERED ( 'Table'[Date] ) = TRUE ()
                    && MAX ( Sales[Date] ) >= selectedmindate
                    && MAX ( Sales[Date] ) <= selectedmaxdate,
                1,
                0
            )
        )
    )

Regards,

Charlie Liao

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.

June 2025 community update carousel

Fabric Community Update - June 2025

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