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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
JimboJamesR
New Member

Shape Map - zoom to state of selected county

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.

6 REPLIES 6
v-sathmakuri
Community Support
Community Support

Hi @JimboJamesR ,

 

May I ask if the provided solution helped in resolving the issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you!!

v-sathmakuri
Community Support
Community Support

Hi @JimboJamesR ,

 

Thank you for reaching out to Microsoft Fabric Community.

 

I have tried reproducing your senarion. Attached the pbix file for reference. Please let us know if you need any additional support.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thank you!!

rajendraongole1
Super User
Super User

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.

 

 





Did I answer your question? Mark my post as a solution!

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi again @rajendraongole1 ,

I've created the above measures and table of distinct state values but I can't quite seem to configure it right.

In the .pbix file in the below shared folder, I've applied the steps above as best I can. Basically, I select Allegheny County and want to see the map zoomed in on its state, Pennsylvania. Currently, it zooms in on any counties in the last state in the list of distinct states, which in my case is TX.

If you could please let me know where I'm going wrong in the attached that would be a great help.

Thank you again

Power BI Shape Map puzzle

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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