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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

show values if present in multiple category filter

I have a table which has the following structure:

NameSubjectMarks
DavidMath80
SusanPhysics76
DavidBiology90
SusanMath88
OliverPhysics56

 

I would like to make a filter for Subject where if I select multiple combination of Subjects then the table will only show the name and marks for those which are present in both Subject filter. for example, if in Subject filter I select Math and Biology then it will only show the result for David only because David is the only person who has this combination. It should not show other results just because they are present in Math. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please try below steps:

1. create a new table

Table 2 = VALUES('Table'[Subject])

2. create a measure with below dax formula

Measure =
VAR tmp =
    SELECTCOLUMNS ( 'Table 2', "Choose Subject", [Subject] )
VAR tmp1 =
    FILTER ( ALL ( 'Table' ), [Subject] IN tmp )
VAR tmp2 =
    SUMMARIZE ( tmp1, [Name], "Distinct Count", DISTINCTCOUNT ( 'Table'[Subject] ) )
VAR _a =
    COUNTROWS ( tmp )
VAR tmp3 =
    CALCULATETABLE (
        VALUES ( 'Table'[Name] ),
        FILTER ( tmp2, [Distinct Count] = _a )
    )
VAR _b =
    SELECTEDVALUE ( 'Table'[Name] )
VAR _c =
    SELECTEDVALUE ( 'Table'[Subject] )
VAR _d =
    SWITCH ( TRUE (), _a = 1, IF ( _c IN tmp, 1 ), _a > 1, IF ( _b IN tmp3, 1 ) )
RETURN
    IF ( ISFILTERED ( 'Table 2'[Subject] ), _d, 1 )

3. add a table visual and slicer visual

Animation42.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

Please try below steps:

1. create a new table

Table 2 = VALUES('Table'[Subject])

2. create a measure with below dax formula

Measure =
VAR tmp =
    SELECTCOLUMNS ( 'Table 2', "Choose Subject", [Subject] )
VAR tmp1 =
    FILTER ( ALL ( 'Table' ), [Subject] IN tmp )
VAR tmp2 =
    SUMMARIZE ( tmp1, [Name], "Distinct Count", DISTINCTCOUNT ( 'Table'[Subject] ) )
VAR _a =
    COUNTROWS ( tmp )
VAR tmp3 =
    CALCULATETABLE (
        VALUES ( 'Table'[Name] ),
        FILTER ( tmp2, [Distinct Count] = _a )
    )
VAR _b =
    SELECTEDVALUE ( 'Table'[Name] )
VAR _c =
    SELECTEDVALUE ( 'Table'[Subject] )
VAR _d =
    SWITCH ( TRUE (), _a = 1, IF ( _c IN tmp, 1 ), _a > 1, IF ( _b IN tmp3, 1 ) )
RETURN
    IF ( ISFILTERED ( 'Table 2'[Subject] ), _d, 1 )

3. add a table visual and slicer visual

Animation42.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks a lot, worked perfectly.

amitchandak
Super User
Super User

@Anonymous, Seem like you need something like

And for Selected Values, All selected values are present: https://youtu.be/X5T4rIZovHk

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors