Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi there,
I have a dataset of vales by county and state in the US.
When a value is selected in a county-level Slicer, I'd like the (state/county-level) Shape Map to zoom to the relevant state. For example, when selecting Clark County, the map zooms to Nevada, with Clark County highlighted in a color of my choosing. With no value selected, it is simply a map of the US.
Do I need a measure that is then used as a filter on the map and, if so, how would I calculate it? Any help greatly appreciated.
Hi @JimboJamesR - you'll need to create a measure that dynamically filters the state based on the selected county.
Create a Measure to Filter the State
SelectedState =
VAR SelectedCounty = SELECTEDVALUE(YourTable[County])
RETURN
CALCULATE(
MAX(YourTable[State]),
YourTable[County] = SelectedCounty
)
When no county is selected, the Shape Map shows the full USA.When a county is selected, the map zooms into the respective state and highlights the county.
Proud to be a Super User! | |
Hi @rajendraongole1 ,
Thanks for your reply.
I've created the above measure "SelectedState". Added to a Card, It returns NV when selecting Clark County from the County Slicer, as expected.
I've turned off filtering on the county-state-level Shape Map for that Slicer, as doing so zooms in at the county level.
When I add the Measure to the Filters pane, I get the option to filter by 'is', 'is not blank', 'is not empty' etc etc. None of these options allow me to zoom in on the map. Can you please advise me what I need to do to get the Shape Map using this measure as a Filter?
Thanks again
Hi @JimboJamesR - Create a Calculated Table for State Filtering
StatesTable = DISTINCT('YourCountyTable'[State])
This creates a list of unique states.
Create a Measure to Match Selected State
FilteredState =
IF(
MAX(StatesTable[State]) = [SelectedState], 1, 0
)
This compares each state with the selected state from the slicer.
Select the Shape Map visual.
In the Filters pane, drag FilteredState to "Visual Filters."
Set it to show only values where FilteredState = 1.
Hope it works.
Proud to be a Super User! | |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
87 | |
80 | |
53 | |
40 | |
39 |
User | Count |
---|---|
102 | |
85 | |
47 | |
46 | |
44 |