Forum Discussion
Filed Azure map - Only Render if a Slicer is Set
- 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.
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 🙂
- Moehimby3 months ago
Helper III
Very nice and clean solution for the filter triggering I love it. I'll give it a shot!
- oussamahaimoud3 months ago
Memorable Member
Thanks and glad for you Moehimby. Don't forget to accept as solution and thumbs up in order to keep helping others 🙂