Forum Discussion

Moehimby's avatar
Moehimby
Icon for Helper III rankHelper III
3 months ago
Solved

Filed Azure map - Only Render if a Slicer is Set

I've encountered this problem before, seems like everytime I want to add an azure map to a report I'm guaranteed misery. Here's the set-up

Single 2million row table with ZIP codes and product stats called 'fact_installs' imported from a semantic model publised in BI service and imported into the local model - then connected to a Calendar[Date] table joined on fact_installs[Install Date] in the model... that's it.

Measure : [Average Stat] = Average ( fact_installs[Stat] )

So I set up my filled map and add ZIP from the fact_installs into the LOCATION well - the map immediately begins to render all the ZIP codes from the 2 million records which I don't want as it crashes. So I added 3 slicers to the page one for STATE, COUNTY, ZIP and wanted to have the map only render if one of those slicers is set to filter the fact_installs table, easy right?

IsFiltered = 
IF(
ISFILTERED(fact_installs[ZIP]) || ISFILTERED(fact_installs[County]) || ISFILTERED(fact_installs[State]) , 1, 0
)

Drag this into the filter for the map, set the filter to "show data if IsFiltered = 1'... easy right? Doesn't work, the map still renders all the ZIP codes until it crashes.

Next I turned to Gemini AI who advised this :

IsFiltered =
IF(
CALCULATE( ISFILTERED(fact_installs[ZIP]), ALLSELECTED() ) ||
CALCULATE( ISFILTERED(fact_installs[County]), ALLSELECTED() ) ||
CALCULATE( ISFILTERED(fact_installs[OwnerState]) , ALLSELECTED() ) ,
1,
0
)

This DID work! Until.... I added a value into the tooltip of the Azure Map (tooltip = [Average Stat] as above) then it went back to rendering every ZIP again until the map crashes.

 

After this, I spent hours going on a wonderous journey with the AI and all sorts of increasing complex DAX statements no human could ever produce and none of them outside of the CALCULATE ( ALLSELECTED() ) one worked, and all failed once I added my [Average Stat] measure into the maps tool tips.

I always have issues when I try to work with large datasets and Azure Maps but I'm particularly aggitated and close to lighting myself on fire this time. It can't be this complicated can it? Can anyone give me some tips on this?

Appreciate your help in advance!!

  • Moehimby's avatar
    Moehimby
    3 months ago

    It is frustrating, yes. Ultimately, my solution was to aggregate the data at the table level in power query, use no measures and apply the table fields directly to the map visual... not ideal, but it works now.

8 Replies

  • Hello Moehimby,

    Hope you're doing well!

     

    Stop trying to detect filtering via the fact table columns. Instead, measure the row count and use that as your gate:

     

    IsFiltered = 

    VAR SelectedZips = CALCULATE( DISTINCTCOUNT(fact_installs[ZIP]), ALLSELECTED(fact_installs) )

    VAR TotalZips = CALCULATE( DISTINCTCOUNT(fact_installs[ZIP]), ALL(fact_installs) )

    RETURN

    IF( SelectedZips < TotalZips, 1, 0 )

     

    Set your visual-level filter to IsFiltered = 1 as before.

     

    Then :

     

    1. Use ALLSELECTED correctly here

    ALLSELECTED(fact_installs) respects slicer context from outside the visual. ALL(fact_installs) gives you the unfiltered universe. The comparison between the two is what detects "a slicer has reduced the set."

     

    2. Set a threshold, not just < TotalZips

    If your ZIP universe is 2M rows, even a state filter might still return 50,000 ZIPs and crash the map. Consider:

    IsFiltered = 

    VAR SelectedZips = CALCULATE( DISTINCTCOUNT(fact_installs[ZIP]), ALLSELECTED(fact_installs) )

    RETURN

    IF( SelectedZips <= 500, 1, 0 )

     

    Pick a threshold your map can actually render (typically <1,000 ZIPs is safe).

     

    3. The tooltip is fine and don't remove it

    The measure in the tooltip is not the problem. The tooltip just exposed that the underlying filter detection was fragile. The fix above handles both cases.

     

    Hope this helps! Don't forget to mark as solution and thumbs up in order to help others 🙂

    • Moehimby's avatar
      Moehimby
      Icon for Helper III rankHelper III

      Very nice and clean solution for the filter triggering I love it. I'll give it a shot!

      • oussamahaimoud's avatar
        oussamahaimoud
        Icon for Memorable Member rankMemorable Member

        Thanks and glad for you Moehimby. Don't forget to accept as solution and thumbs up in order to keep helping others 🙂

  • I completely understand your frustration. Azure Maps is notoriously aggressive because it evaluates the location data pipeline separately from standard visual filters to build its spatial tile layers.

    The reason your ISFILTERED logic breaks the moment you add [Average Stat] to the tooltip is because of Filter Context. Inside the Azure Map visual engine, it loops through every single ZIP code in your 2-million-row table to prepare the visual grid. When a measure like [Average Stat] is present in the tooltips, it forces a context transition for every row being evaluated. This causes your validation measure to see active filters where it shouldn't, failing the check and rendering the entire dataset until it crashes.

    The good news is it doesn't have to be this complicated. Instead of trying to filter the visual container using a separate flag measure in the Filter Pane, the golden rule for stopping a map from rendering is to embed the filter logic directly inside the data measure itself, or force an empty result on the location field.

    Here is the clean, human-designed solution to fix this permanently without causing any HTML validation issues on your forum post.

    The Solution: Intercept the Location Data Stream

    Instead of dropping the raw ZIP column into the Location well, you need to create a Secure Location Measure that returns blank if no slicer is selected. This forces Azure Maps to see zero rows before it even attempts to draw a boundary.

    First, create this measure to handle your location routing safely:

     

    Secure ZIP Location = 
    IF(
        ISFILTERED(fact_installs[ZIP]) || 
        ISFILTERED(fact_installs[County]) || 
        ISFILTERED(fact_installs[State]),
        SELECTEDVALUE(fact_installs[ZIP]),
        BLANK()
    )

     Next, clear out the raw ZIP column from your Azure Map's Location well completely, and replace it by dragging this new [Secure ZIP Location] measure straight into the Location slot.

    Why This Fix Is Bulletproof With Tooltips

    By shifting the logic directly into the location field evaluation, Power BI evaluates the slicer state before passing rows down the visual pipeline. If none of your three slicers are active, the Secure ZIP Location measure returns BLANK() for the entire table.

    Because the map sees absolutely no location points to bind data against, it never executes the tooltip context transition loop for your 2 million rows, completely stopping the crash. The moment a user interacts with a State, County, or ZIP slicer, the conditional rule unlocks, allowing the map to render only the filtered, manageable subset of data seamlessly.

    • Moehimby's avatar
      Moehimby
      Icon for Helper III rankHelper III

      Hey thanks very much for this - it's a solution I'd considered and tried - unfortunately the map's Location well will only accept a table field and won't allow using a measure at all which honestly broke my heart a bit when I discovered so.

       

      Interestingly enough - if I remove the [Average Stat] measure from the tooltips and replace it with the data field from the table it pulls from and set it to aggregate as AVG the map filtering logic holds so I think that's the approach to use - just allow BI to make an implicit measure for these stupid maps which feels dirty but...

       

      Hopefully MS makes the azure map visual better soon. Thanks so much for your advice!

  • v-sgandrathi's avatar
    v-sgandrathi
    Icon for Community Support rankCommunity Support

    Hi Moehimby,

     

    Thank you for sharing the update. That’s an insightful observation about the differences in behavior between explicit measures and implicit aggregations in Azure Maps.

    Your findings will be helpful for others dealing with large datasets and similar rendering issues. Hopefully, Microsoft will enhance the visual’s performance and optimization in future updates.

     

    Thank you.

    • Moehimby's avatar
      Moehimby
      Icon for Helper III rankHelper III

      It is frustrating, yes. Ultimately, my solution was to aggregate the data at the table level in power query, use no measures and apply the table fields directly to the map visual... not ideal, but it works now.

  • v-sgandrathi's avatar
    v-sgandrathi
    Icon for Community Support rankCommunity Support

    Hi Moehimby,

     

    Thank you for sharing the workaround you used.

    Your insight into how Azure Maps handles very large datasets with explicit measures in tooltips is helpful. Noting that implicit aggregations tend to work more reliably in these cases will be valuable for others experiencing similar rendering and performance issues.

    Pre-aggregating data in Power Query and connecting table fields directly to the visual is a practical way to enhance stability when working with high-volume geographic data.

     

    Appreciate if you could share the feedback on our Microsoft Fabric Ideas. Which would be open for the user community to upvote & comment on. This allows our product teams to effectively prioritize your request against our existing feature backlog and gives insight into the potential impact of implementing the suggested feature.

    Fabric Ideas - Microsoft Fabric Community

     

    Thank you.