Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
HenryCrun
New Member

Slicing across characteristics where each item could have many, some, or no characteristics

Say I have a map of businesses. I want to filter the map, say with a slicer, to businesses that provide a certain service. Say my data looked like this:

 

BusinessNameLocationDoesGiftWrappingDoesPetCareDoesCarCleaningDoesPhoneRepair
ABC Inc[address]TRUETRUEFALSEFALSE
DEF Ltd[address]FALSETRUEFALSEFALSE
QRS and Co[address]FALSETRUEFALSETRUE
XYZ Industries[address]TRUEFALSETRUEFALSE

 

I want a set up where the end user can select one service – say, gift wrapping – and the map will only show businesses that do gift wrapping (in this case, where DoesGiftWrapping is true). In my real example, there are thirteen potential services any business could provide. 

 

How do I begin to go about this?

2 ACCEPTED SOLUTIONS
Irwan
Super User
Super User

hello @HenryCrun 

 

i would do something like this.

 

1. unpivot the data

Irwan_0-1725858517020.png

 

2. create a calculated column for filter/slicer that only for True value

Irwan_1-1725858578207.png

 

3. create table and slicer visual (the slicer contain value from the previously made calculated column).

Irwan_2-1725858636279.png

Irwan_3-1725858646503.png

 

4. remove (Blank) value in slicer. This appears because of the if statement in calculated column.

Irwan_4-1725858740224.png

 

Hope this will help.

Thank you.

View solution in original post

v-cgao-msft
Community Support
Community Support

Hi @HenryCrun ,

 

Provide a way to possibly if more than one choice is made.

The first step is to unpivot the data like Irwan suggested.

Then please create a new measure like:

 

Measure = 
VAR __cur_location = SELECTEDVALUE('Table'[Location])
VAR __locations = CALCULATETABLE(VALUES('Table'[Location]),'Table'[Value]=TRUE())
VAR __true_count = CALCULATE(DISTINCTCOUNT('Table'[Attribute]),'Table'[Value]=TRUE())
VAR __selected_count = COUNTROWS(ALLSELECTED('Table'[Attribute]))
VAR __result = IF(__cur_location IN __locations && __true_count=__selected_count, 1)
RETURN
    __result

 

Apply it the visual's filter:

vcgaomsft_0-1725934039263.png

Output:

vcgaomsft_1-1725934056882.png

 

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @HenryCrun ,

 

Provide a way to possibly if more than one choice is made.

The first step is to unpivot the data like Irwan suggested.

Then please create a new measure like:

 

Measure = 
VAR __cur_location = SELECTEDVALUE('Table'[Location])
VAR __locations = CALCULATETABLE(VALUES('Table'[Location]),'Table'[Value]=TRUE())
VAR __true_count = CALCULATE(DISTINCTCOUNT('Table'[Attribute]),'Table'[Value]=TRUE())
VAR __selected_count = COUNTROWS(ALLSELECTED('Table'[Attribute]))
VAR __result = IF(__cur_location IN __locations && __true_count=__selected_count, 1)
RETURN
    __result

 

Apply it the visual's filter:

vcgaomsft_0-1725934039263.png

Output:

vcgaomsft_1-1725934056882.png

 

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Irwan
Super User
Super User

hello @HenryCrun 

 

i would do something like this.

 

1. unpivot the data

Irwan_0-1725858517020.png

 

2. create a calculated column for filter/slicer that only for True value

Irwan_1-1725858578207.png

 

3. create table and slicer visual (the slicer contain value from the previously made calculated column).

Irwan_2-1725858636279.png

Irwan_3-1725858646503.png

 

4. remove (Blank) value in slicer. This appears because of the if statement in calculated column.

Irwan_4-1725858740224.png

 

Hope this will help.

Thank you.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.