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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
smillward
Frequent Visitor

Slicer / Filter Against Multiple Columns

I want to be able Filter or slicer a set of data, based on values within two seperate columns.

 

Currently it is stored like This

 

Player 1   Player 2   Viewers   Game

Bert         Ernie          50            Halo

Ernie        Hank         32            Geometry Wars

George    Hank         51            Halo

 

My ideal situation is to have a slicer, with each of the players names (Bert, Ernie, George and Hank) that will allow me to see, in this example the total viewers of game this player has played,

 

So Bert: 50, Ernie: 82, George: 51, Hank: 83

 

I also would like if two names are selected, to display the total viewers of the two player combined,

 

so selecting George + Ernie: 133.

 

 

So far I have been unable to come up with a solution, so any advice or suggestion would be welcome, and I am able to restructure the data in order to get to the desired result.

 

As a flag, this is to be a page level filter/slicer, and it is not just a question of reaching the number by calculate(sum(), player="")

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @smillward,

 

You can try to use contains function to achieve your requirement.

 

Sample:

1. Use"player 1" and "player 2" to create a selector table.

Select = UNION(VALUES(Game[Player 1]),VALUES(Game[Player 2])) 

 

2. Write a measure to calculate selected value.

Total = CALCULATE(SUM(Game[Viewers]),FILTER(ALL(Game),CONTAINS(ALLSELECTED('Select'[Player 1]),'Select'[Player 1],[Player 1])||CONTAINS(ALLSELECTED('Select'[Player 1]),'Select'[Player 1],[Player 2])))

 

3. Use "Select" table as the source of slicer, then drag total measure to card visual.

3.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @smillward,

 

You can try to use contains function to achieve your requirement.

 

Sample:

1. Use"player 1" and "player 2" to create a selector table.

Select = UNION(VALUES(Game[Player 1]),VALUES(Game[Player 2])) 

 

2. Write a measure to calculate selected value.

Total = CALCULATE(SUM(Game[Viewers]),FILTER(ALL(Game),CONTAINS(ALLSELECTED('Select'[Player 1]),'Select'[Player 1],[Player 1])||CONTAINS(ALLSELECTED('Select'[Player 1]),'Select'[Player 1],[Player 2])))

 

3. Use "Select" table as the source of slicer, then drag total measure to card visual.

3.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Trying to do the same, but this DAX doesn't work for me. 

 

Combined Budget = CALCULATE(SUM('Sheet1 (2)'[budget]),FILTER(ALL(Sheet1[Merged]),CONTAINS(ALLSELECTED('Selector Table'[owner]),'Selector Table'[owner],[Budget Sum])||CONTAINS(ALLSELECTED('Selector Table'[owner]),'Selector Table'[owner],[Budget Sum])))

 

The Card visual with this measure gives me the dreaded "Can't display visual", and the slicer does not apply to other visuals.

I have created a selector table from my end, however i noticed that the slicer doesn't work. Do we require to link this newly created selector table to link this again or something?

 

I've been struggling for a while today with this, hope you guys know the answer!!

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.