Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Galoyol84
Helper I
Helper I

Pin selection from slicer

Hello Community,

 

I'm trying to create a line chart to show the results of an indicator by country and by year. Additionally I would like to have the region value all the time so I can compare specific results.

 

What I had in mind was to add a DAX expression in the filters. I came up with this measure:

 

default country =
IF(
CALCULATE(ISFILTERED(FactCountryIndicator[Country]),ALLSELECTED(FactCountryIndicator[Country]),SELECTEDVALUE(FactCountryIndicator[Latin America & the Caribbean])
))))
 
But it is not working.
 
Any help would be appreciated
 
PS
I share the file
1 ACCEPTED SOLUTION

HI @Galoyol84,

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
az38
Community Champion
Community Champion

@Galoyol84 

try to create column, not measure

but i can not to understand what result do you expect


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

I would like to end up with this

 

Captura de pantalla 2020-05-13 a la(s) 17.05.03.png

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 @Galoyol84,

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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