0
votes

I have a below scenario in which i have a location slicer which filters the table perfectly.

Current Situation

What i required is when location is selected in slicer it should show All location but filtered values as 0.

Result

How can i achieve this in power BI

1

1 Answers

1
votes

First create a new table Location with all distinct locations like the following:

enter image description here

And create a relationship like this:

enter image description here

Use the Location column from the Location table to create the slicer. Finally use the following dax function to create a measure:

Measure = 
VAR __location = SELECTEDVALUE( 'Location Table'[Location] )
VAR __flag = COUNTROWS( 'Location Table' ) 
Return 
IF( 
    __flag > 1,
    SUM( 'Table'[Values] ),
    IF(
        SELECTEDVALUE( 'Table'[Location] ) = __location,
        SUM( 'Table'[Values] ),
        0 
    ) 
)

This is the expected result:

enter image description here