cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vrocca Member
Member

How to show/hide points on a map based on slicer

Hi all - I'm trying to create a Map chart, using a field with Lat,Long coordinates to plot my values, and I only want to show the points when the data is filtered to a State. Is there a DAX formula that can help me achieve this?

 

My data in the table looks like this:

 

State | Location

FL          29.7,-85.02

FL          30.4,-83.4

TX         30.05,-94.75

TX         32.70,-99.3

 

I have a State slicer on the dashboard. If no state has been selected, I don't want the map to show any points (or maybe default it to somewhere in the center of the U.S.). Once a State has been selected on the slicer, then the map would display the Locations within that state.

 

Thanks in advance!

Thanks,
Victor Rocca | www.victorrocca.com
2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: How to show/hide points on a map based on slicer

Perhaps a little tricky. Create a measure IsFiltered like:

 

IsFiltered = ISFILTERED(Cities[State]) * 1.

Change the type of the measure to Whole Number.

 

Add "IsFiltered" to your Visual Level Filters. 

 

Set it to only display when IsFiltered = 1.


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

Microsoft v-micsh-msft
Microsoft

Re: How to show/hide points on a map based on slicer

Hi vrocca,

 

 

I checked the page you shared, but the page showing me a Message not found information. Would it be available for you to share the filter configuration with a screenshot in your next post?

 

If the Map Chart already has one filter applied, then we may consider change the measure with the formula below:

ISfiltered = IF(

                    ISFILTERED(Table[State]),

                        IF(HASONEFILTER(Table1[State]),

                             0,

                             1),

                    0)

Then, add the ISfiltered to Map Chart Visual level filter, and apply filter when the value is set to 1. See if this would make the slicer work.

And if any further help needed, please feel free to post back.

Regards

View solution in original post

6 REPLIES 6
Super User
Super User

Re: How to show/hide points on a map based on slicer

Perhaps a little tricky. Create a measure IsFiltered like:

 

IsFiltered = ISFILTERED(Cities[State]) * 1.

Change the type of the measure to Whole Number.

 

Add "IsFiltered" to your Visual Level Filters. 

 

Set it to only display when IsFiltered = 1.


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

jayeckles Member
Member

Re: How to show/hide points on a map based on slicer

If the data from the slicer and the map are coming from the same table, it's in the bag.

 

If not, you need a cross-filtered relationships between the slicer table and the table the map data comes from.  If you remind me on Monday, I'll pull out the dashboard where I've done exactly this and see if I can give you more details.

vrocca Member
Member

Re: How to show/hide points on a map based on slicer

Ok, I see what's going on in my dashboard now. I have a  Report Level filter on the States to exclude states for which I have no data for. So when I use the ISFILTERED() function, it always returns true regardless of what I select on the slicer in the dashboard. Any thoughts on how to get around this? 

 

BTW you can access the dashboard here: http://community.powerbi.com/t5/Data-Stories-Gallery/U-S-Weather-Analysis/m-p/55879

 

 

Thanks,
Victor Rocca | www.victorrocca.com
Microsoft v-micsh-msft
Microsoft

Re: How to show/hide points on a map based on slicer

Hi vrocca,

 

 

I checked the page you shared, but the page showing me a Message not found information. Would it be available for you to share the filter configuration with a screenshot in your next post?

 

If the Map Chart already has one filter applied, then we may consider change the measure with the formula below:

ISfiltered = IF(

                    ISFILTERED(Table[State]),

                        IF(HASONEFILTER(Table1[State]),

                             0,

                             1),

                    0)

Then, add the ISfiltered to Map Chart Visual level filter, and apply filter when the value is set to 1. See if this would make the slicer work.

And if any further help needed, please feel free to post back.

Regards

View solution in original post

vrocca Member
Member

Re: How to show/hide points on a map based on slicer

Thanks! I ended up applying the report filters in the data query, and then using the ISFILTERED() function. I had to bring in a measure from the main table so that when ISFILTERED() returned 1, it would only show stations with data associated with them. Here's the end result if you are interested: https://app.powerbi.com/reports/7261ca37-fd37-4a58-942b-5c62fd26964e

Thanks,
Victor Rocca | www.victorrocca.com
DivyaP Frequent Visitor
Frequent Visitor

Re: How to show/hide points on a map based on slicer

Hi Victor,

am not able to access your dashboard.

I am trying to get the value selected in a slicer. Ex: table displaying Year along with the other values where as slicer is on the Year column of the same table.

I created a measure as test =ISFILTERED(DateTime[FiscalYear])

This is always giving false irrespective of whether i filter the table using slicer or not.

 

Note: am using direct excel as the source and not done any modification to the data at query level or report level.

 

Thanks in advance

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)