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
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
Employee
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
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.