The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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:
Solved! Go to 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
try to create column, not measure
but i can not to understand what result do you expect
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 @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
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
77 | |
76 | |
47 | |
38 |
User | Count |
---|---|
147 | |
115 | |
65 | |
64 | |
53 |