I have a below scenario in which i have a location slicer which filters the table perfectly.
What i required is when location is selected in slicer it should show All location but filtered values as 0.
How can i achieve this in power BI
First create a new table Location with all distinct locations like the following:
And create a relationship like this:
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: