The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I would like to create a map visualization that changes the level based on "Country" slicer.
If there is only one selection and the selected value is "United States", then the map should show in "State" level.
If there is only one selection and the selected value is NOT "United States", then the map should show in "City" level.
If there are more than one selection in the Country Slicer, then the map should show in "Country" level.
Is this something that is possible?
Solved! Go to Solution.
Hi @jxkang
The native visual doesnt support this definitely.
One way to go by would be using bookmark and dax to show any of the 3 visuals based on selected value but I wouldnt recommend this.
You could try using a Field Paramter with 3 fields Country, State and City
Then have a measure to control this selection
SelectedLevel =
VAR CountrySelected = SELECTEDVALUE('YourTable'[Country])
VAR CountCountries = DISTINCTCOUNT('YourTable'[Country])
RETURN
IF(
CountCountries > 1,
"Country",
IF(
CountrySelected = "United States",
"State",
"City"
)
)
You could probably display a card and use this to change the slicer appropriately based on recommendation.
If definitely it needs to be automatic then bookmarks works like this:
3 visuals and manage visibility (i.e visual level filters):
ShowCountryMap = IF([SelectedLevel] = "Country", 1, 0)
ShowStateMap = IF([SelectedLevel] = "State", 1, 0)
ShowCityMap = IF([SelectedLevel] = "City", 1, 0)
Set it to 1 in each of the 3 visuals after creating them
Hi @jxkang,
Thank you for reaching out to the Microsoft fabric community forum. Also, thanks to @MohamedFowzan1, fot his inputs on this thread. I reproduced the scenario, and it worked on my end. I used my sample data and successfully implemented it.
I am also including .pbix file for your better understanding, please have a look into it:
Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Community Forum.
Hi @jxkang
The native visual doesnt support this definitely.
One way to go by would be using bookmark and dax to show any of the 3 visuals based on selected value but I wouldnt recommend this.
You could try using a Field Paramter with 3 fields Country, State and City
Then have a measure to control this selection
SelectedLevel =
VAR CountrySelected = SELECTEDVALUE('YourTable'[Country])
VAR CountCountries = DISTINCTCOUNT('YourTable'[Country])
RETURN
IF(
CountCountries > 1,
"Country",
IF(
CountrySelected = "United States",
"State",
"City"
)
)
You could probably display a card and use this to change the slicer appropriately based on recommendation.
If definitely it needs to be automatic then bookmarks works like this:
3 visuals and manage visibility (i.e visual level filters):
ShowCountryMap = IF([SelectedLevel] = "Country", 1, 0)
ShowStateMap = IF([SelectedLevel] = "State", 1, 0)
ShowCityMap = IF([SelectedLevel] = "City", 1, 0)
Set it to 1 in each of the 3 visuals after creating them
Hi @jxkang
The native visual doesnt support this definitely.
One way to go by would be using bookmark and dax to show any of the 3 visuals based on selected value but I wouldnt recommend this.
You could try using a Field Paramter with 3 fields Country, State and City
Then have a measure to control this selection
SelectedLevel =
VAR CountrySelected = SELECTEDVALUE('YourTable'[Country])
VAR CountCountries = DISTINCTCOUNT('YourTable'[Country])
RETURN
IF(
CountCountries > 1,
"Country",
IF(
CountrySelected = "United States",
"State",
"City"
)
)
You could probably display a card and use this to change the slicer appropriately based on recommendation.
If definitely it needs to be automatic then bookmarks works like this:
3 visuals and manage visibility (i.e visual level filters):
ShowCountryMap = IF([SelectedLevel] = "Country", 1, 0)
ShowStateMap = IF([SelectedLevel] = "State", 1, 0)
ShowCityMap = IF([SelectedLevel] = "City", 1, 0)
Set it to 1 in each of the 3 visuals after creating them