Filtering Reference Layers
Icon Map Pro provides the ability to show reference layers on the map. These reference layers are not connected to the Power BI data, they just additional context to the data layer.
Take this example that shows a map of Welsh local authorities. The circles are a circle data layer, and the local authorities are loaded as a GeoJSON reference layer.
But what if I had a small sales team where each one was responsible for a small number of local authorities, so you only wanted to show those relevant to that person.
We could change the reference layer to being a GeoJSON data layer, but then we'd need to append the relevant local authorities as additional rows of data, which can then get messy from a data preparation and modelling point of view.
Instead, we can filter the features from the GeoJSON reference layer, and only show those related to each sales person.
I've added a table of data in my model that lists which area each sales person is responsible for:
The code field corresponds to a field "LAD22CD" in my GeoJSON file, so in the Icon Map Pro settings for the reference layer, I've selected "LAD22CD" in the "Property to Filter" option:
If there was just one area for each sales person, we could simply assign the "Code" field from our table to the "Filter Value" setting using the fx button. However, as we have multiple areas per person, we will need to create a DAX measure to generate a concatenated list of areas:
Codes = CONCATENATEX('wales_areas json', "'" & 'wales_areas json'[Code] & "'", ",")
Now we can assign our Codes measure to the Filter Value setting. Note comma separated lists of values are only supported when WebGL Rendering is enabled in the Icon Map Pro settings:
I've added the Person Allocation as a slicer so we can pick the sales person, and their territories will be displayed on the map:
We can even make this more sophisticated by applying Row Level Security and use the USERPRINCIPALNAME() DAX function to automatically filter to the logged in user. I wouldn't recommend this as a security mechanism, but as a way to automate the filtering.
You can download the Power BI file to see this in action.