Forum Discussion
Pin selection from slicer
- Anonymous6 years ago
HI Anonymous,
AFAIK, power bi does not support setting the default value of filter/slicers. (Dax formulas also not support direct interaction with the filter/slicer section)
For this scenario, you can use unrelated table 'country' field on the slicer and create measure formula with conditions to set a default value and compare with current value to return tag. (you can use it on visual level filter use the result tag to confirm displayed records)
Calculate table:
Country Selector= ALL( Table[Country] )Measure:
Measure filter on Slicer = VAR currValue = SELECTEDVALUE ( Table[Country] ) VAR default = "Latin America and the Caribbean" RETURN IF ( currValue <> default , "Y", "N" )After these steps, you can write a measure as filter on your line chart to check current value and selected value from slicer.
Measure filter on Chart = VAR currValue = SELECTEDVALUE ( Table[Country] ) VAR default = "Latin America and the Caribbean" VAR selected = ALLSELECTED ( 'Country Selector'[Country] ) RETURN IF ( currValue IN selected || currValue = default, "Y", "N" )Regards,
Xiaoxin Sheng
I would like to end up with this
Hence you can select more countries and compare them with the region.
In my model what I have is a column of indicators with four of them and information about five countries plus Latin America and the Caribbean.
PS I don't want that Latin America shows in the slicer, just in the chart
HI Anonymous,
AFAIK, power bi does not support setting the default value of filter/slicers. (Dax formulas also not support direct interaction with the filter/slicer section)
For this scenario, you can use unrelated table 'country' field on the slicer and create measure formula with conditions to set a default value and compare with current value to return tag. (you can use it on visual level filter use the result tag to confirm displayed records)
Calculate table:
Country Selector= ALL( Table[Country] )
Measure:
Measure filter on Slicer =
VAR currValue =
SELECTEDVALUE ( Table[Country] )
VAR default = "Latin America and the Caribbean"
RETURN
IF ( currValue <> default , "Y", "N" )
After these steps, you can write a measure as filter on your line chart to check current value and selected value from slicer.
Measure filter on Chart =
VAR currValue =
SELECTEDVALUE ( Table[Country] )
VAR default = "Latin America and the Caribbean"
VAR selected =
ALLSELECTED ( 'Country Selector'[Country] )
RETURN
IF ( currValue IN selected || currValue = default, "Y", "N" )
Regards,
Xiaoxin Sheng