Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I was inspired by seeing some reports that used dynamic legends for charts through the use of setting up inactive relationships and a field-category reference table. What I would love to be able to do is use the same principle for a report I have that includes a series of azure maps with lat+long pairs of locations - where instead of having to switch pages to different legend sets (based on columns/groups in the original data), to be able to switch between them on the same page.
I have managed to get it to change the legend items themselves by the selection, which is ultimately using the slicer to filter down the options on the legends query table, but I cannot get to the final step, because as soon as I try to introduce the Latitude and Longitudes, they need the relationships to be operational, but I cannot figure out the right Calculate function that will allow me to userelationship to activate the links but also be using individual map dots.
I cannot seem to find anything online that might help, but the videos that inspired me were: Parker Stevens "Power BI Dynamic Axes and Legends" and Goodly's Create Interesting Maps in Power BI (which uses a slicer to pick the "n" in TopN for conditional highlighting).
Any ideas? (and thank you!)
Solved! Go to Solution.
Hi @ForumsDB,
The issue here with you is that when you introduce latitude/longitude coordinates, Power BI needs active relationships to properly filter and display the map points but you need inactive relationships for the dynamic legend switching
So Here is Some solutions you could try:
Dynamic Map Measure =
CALCULATE(
[Your Map Value],
USERELATIONSHIP(LegendCategories[Category], PBILINK[Role]),
USERELATIONSHIP('YourDataTable'[Key], PBILINK[LinkKey])
)Dynamic Category =
SWITCH(
TRUE(),
ISFILTERED(LegendCategories[Role (HighLevel)]), SELECTEDVALUE(PBILINK[Role (HighLevel)]),
ISFILTERED(LegendCategories[Role - Level)]), SELECTEDVALUE(PBILINK[Role - Level)]),
SELECTEDVALUE(PBILINK[Role])
)
Bonus approach (without measures)
Create active relationships from this bridge to both your legend data and coordinate data
Tell me if it works I am waiting ☺️❤️
Thank you so much for your suggestions!
I have some questions:
The Dynamic category option will not apply to the map legend, but not sure I am getting that one to work successfully, but this might be me missing the point here.
With the first suggestion, the dynamic map measures - what am I to be using for those [map value] points? I had tried to make some switch measures for latitudes or longitudes in different selections but it kept throwing errors.
That being said, the third option worked for what I needed it to, or at least how I interpreted it!
I took the base data [pbilink] and duplicated it, removed a bunch of columns and then unpivoted the fields that I used for the categories. Then linked them up index:index and flowed the "options" from the table that I use on the slicer into the legend categories table, which is linked to the values in that new table.
I might need to go back and add a column to the original to get the third one I want as that was made by grouping, but this has allowed me to do what I needed, even if perhaps not the most elegantly(!) Thank you!
Thankyou, @ Ahmed-Elfeel for your response.
Hi ForumsDB,
Thank you for the update and we are glad to hear that the unpivot (or bridge) approach is working for you.
Based on my understanding, Azure Maps requires actual model columns (not measures) for both the Legend and Latitude/Longitude fields. When a Legend field is a measure, the visual displays: “This field can’t be used here because a non-measure field is required.” This behaviour is expected, because Azure Maps needs fixed categorical fields and physical numeric coordinate columns to render points correctly.
Measures cannot be used in the Legend bucket. Azure Maps accepts only a column for Legends, which is why SWITCH based legend logic cannot be applied there. Your current unpivoted CategoryType/CategoryValue structure correctly provides the visual with a single categorical column, which is why it works.
If you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
Hi @ForumsDB,
The issue here with you is that when you introduce latitude/longitude coordinates, Power BI needs active relationships to properly filter and display the map points but you need inactive relationships for the dynamic legend switching
So Here is Some solutions you could try:
Dynamic Map Measure =
CALCULATE(
[Your Map Value],
USERELATIONSHIP(LegendCategories[Category], PBILINK[Role]),
USERELATIONSHIP('YourDataTable'[Key], PBILINK[LinkKey])
)Dynamic Category =
SWITCH(
TRUE(),
ISFILTERED(LegendCategories[Role (HighLevel)]), SELECTEDVALUE(PBILINK[Role (HighLevel)]),
ISFILTERED(LegendCategories[Role - Level)]), SELECTEDVALUE(PBILINK[Role - Level)]),
SELECTEDVALUE(PBILINK[Role])
)
Bonus approach (without measures)
Create active relationships from this bridge to both your legend data and coordinate data
Tell me if it works I am waiting ☺️❤️
Thank you so much for your suggestions!
I have some questions:
The Dynamic category option will not apply to the map legend, but not sure I am getting that one to work successfully, but this might be me missing the point here.
With the first suggestion, the dynamic map measures - what am I to be using for those [map value] points? I had tried to make some switch measures for latitudes or longitudes in different selections but it kept throwing errors.
That being said, the third option worked for what I needed it to, or at least how I interpreted it!
I took the base data [pbilink] and duplicated it, removed a bunch of columns and then unpivoted the fields that I used for the categories. Then linked them up index:index and flowed the "options" from the table that I use on the slicer into the legend categories table, which is linked to the values in that new table.
I might need to go back and add a column to the original to get the third one I want as that was made by grouping, but this has allowed me to do what I needed, even if perhaps not the most elegantly(!) Thank you!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 103 | |
| 80 | |
| 64 | |
| 50 | |
| 45 |