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
nevjohnson
Regular Visitor

Conditional Filter

Dear Community,

 

I cannot seem to find a simple way to create a filter on two items with an AND condition,.

Take the example dataset below.

How can I easily represent/filter on students that have a qualification in Mathematics and Physics? Thanks in advance for your guidance. Br, Nev 

 


Student Qualification In
A History
A Mathematics
B Spanish
B Physics
B Mathematics
C Mathematics
C Physics
D Physics
E Geography
E Physics
E Mathematics
E History

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @nevjohnson,

After research and test, I can get the expected result. When you select both Mathematics and Physics, I create a measure to decide whether the student have choosed both of the class, it will return 1 if he have both of the classes, otherwise, it returns 0. Then put the measure in visual level filter.

1.PNG

Both the qualification or not =
IF (
CALCULATE ( DISTINCTCOUNT ( Table1[Qualification] ), ALLSELECTED ( Table1 ) )
= CALCULATE (
DISTINCTCOUNT ( Table1[Qualification] ),
ALLSELECTED ( Table1[Qualification] )
),
1,
0
)


Please download the .pbix file for more detailed information.

Best Regards,

Angelia

View solution in original post

1 REPLY 1
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @nevjohnson,

After research and test, I can get the expected result. When you select both Mathematics and Physics, I create a measure to decide whether the student have choosed both of the class, it will return 1 if he have both of the classes, otherwise, it returns 0. Then put the measure in visual level filter.

1.PNG

Both the qualification or not =
IF (
CALCULATE ( DISTINCTCOUNT ( Table1[Qualification] ), ALLSELECTED ( Table1 ) )
= CALCULATE (
DISTINCTCOUNT ( Table1[Qualification] ),
ALLSELECTED ( Table1[Qualification] )
),
1,
0
)


Please download the .pbix file for more detailed information.

Best Regards,

Angelia

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.