The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a list of Attractions and Restaurants I want to display on a map in PBI.
Here is the table I am using. I want to be able to filter on an attraction, and it will show me the 1 attraction as well as all the restaurants in the bubble
Location AddressType Type Size
Georgia Aquaium | 225 Baker St NW, Atlanta, GA 30313 | Attraction | 5000 |
Fox Theater | 660 Peachtree St NE, Atlanta, GA 30308 | Attraction | 5000 |
Museum of Ilusions | 264 19th St NW Suite 2200, Atlanta, GA 30363 | Attraction | 5000 |
Five Guys | 860 Peachtree St NE, Atlanta, GA 30308 | Restaurant | 1 |
Checkers | 120 Piedmont Ave NE Suite B Suite B, Atlanta, GA 30303 | Restaurant | 1 |
Moes | 171 Auburn Ave NE, Atlanta, GA 30303 | Restaurant | 1 |
Jimmy Johns | 400 W Peachtree St NW, Atlanta, GA 30308 | Restaurant | 1 |
Food Shop | 123 Luckie St NW UNIT 108, Atlanta, GA 30303 | Restaurant | 1 |
Hi @jnguyen21 ,
Took @rohit1991 posted as starting point and improved it for your use case.
The Following are the Outcomes
1. When Attraction is selected in Type, the Location Slicer gets filtered to show only Attractions, but Map will show both Attractions and Restaurants. If a Location is filtered in the slicer, the map will show the Location and all the restaurants available
2. When Restaurant is selected in Type, the Location Slicer gets filtered to show only the Restaurants and the Map will also show only the restaurants.
Note: Everytime you change the Type Slicer, Reset the Location Slicer for it to reflect the correct state
Added an additional table too, just to help you understand how the measure value changes for the selection. PFB the screenshots associated.
Steps:
1. Create AllLocation table having Location and Type Columns
2. Create Type table having only the Type as the column.
3. The Above two tables are joined using Type column. But are not joined with the main fact table. Refer screenshot below
4. Created the below measure.
IsSelected =
IF(SELECTEDVALUE('Type'[Type]) = "Attraction",
IF (
ISFILTERED(AllLocation[Location]),
IF (
SELECTEDVALUE(AllLocation[Location]) = SELECTEDVALUE('Table'[Location]),
"Selected",
IF(SELECTEDVALUE('Table'[Type]) = "Restaurant","Selected","Not Selected")
),
"Selected"
),
IF(SELECTEDVALUE('Table'[Type]) = "Attraction","Not Selected",IF(ISFILTERED(AllLocation[Location]),IF(SELECTEDVALUE(AllLocation[Location]) = SELECTEDVALUE('Table'[Location]), "Selected", "Not Selected"), "Selected")
))
5. Add Address to Location, Type to Legend and Size to BubbleSize in the map visual and Add the "IsSelected" measure as a visual filter to your map visual and Filter it to "Selected". Refer screenshot below
Output:
1. When Attraction is selected in Type
2. When Restaurant is selected in Type
Hope this helps ! If this solves your need, mark it as solution. Appreciate a Kudo !!
Hi @jnguyen21
Could you please follow Steps to Implement
1. Create a base Locations table
This should include:
a. Location
b. Address
c. Latitude & Longitude
d. Type / Size (if needed)
(This table should include all possible locations not just filtered ones.)
2. Don't connect this table to any other table
Keep it unlinked (no relationships). This prevents slicers from removing data from the map visual.
3. Create a Slicer Table
Create a second table (e.g., Location Filter) with unique values for filtering (Location, Type, etc.). This will be used in slicers.
4. Create a Selection Measure
Use the following DAX measure to detect selection and highlight:
IsSelected =
IF (
ISFILTERED(LocationFilter[Location]),
IF (
SELECTEDVALUE(LocationFilter[Location]) = Locations[Location],
"Selected",
"Not Selected"
),
"Selected"
)
Use this Measure in the Map Visual
Place the Location field from the base Locations table on the map.
Use the IsSelected measure in Legend or Conditional Formatting to distinguish between "Selected" and "Not Selected".
The map will now always show all points, but only selected ones will be emphasized.
Load Your Data into Power BI: Import your table with Location, Type, and Size.
Create a Map: Add a Map visual. Drag Location to Location, Type to Legend, and Size to **Size`.
Create a DAX Measure: Go to Modeling > New Measure and add this: AlwaysShow = 1 This creates a simple flag that always equals 1.
Apply the Measure to the Map: Drag AlwaysShow to the Filters on this visual pane. Set the filter to is 1. This ensures all rows are always shown, regardless of slicer selections.
Optional: Add a Slicer for Filtering: Add a slicer with Location or Type. The map will keep showing all locations while still highlighting the filtered results.
Now, the map will always display all locations, but filtered selections will be highlighted!
I am not sure I follow. Even though I put always show, it still wants to filter down when I select Location