Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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 ,
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!!
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!!
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! | |
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
User | Count |
---|---|
84 | |
79 | |
71 | |
48 | |
43 |
User | Count |
---|---|
111 | |
54 | |
50 | |
41 | |
40 |