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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Greenterer
Helper I
Helper I

Filter out multiple rows based on data in just one of those rows

I have data in the following format

Student      Class
Joe             Math
Joe             English
Sally           English

Becky         Science

 

I want to filter out any students who have taken a math class, so that my results would look like this:

Student      Class

Sally           English
Becky         Science

 

My problem is that when I try to filter out anyone who took their math class that Joe's row that includes math is removed but his row that includes english class remains.  How would I get both of Joe's rows to be removed?  In other words, I only want to see people who have not taken a math class.

1 ACCEPTED SOLUTION
ArwaAldoud
Super User
Super User

Hi @Greenterer 

You can achieve this by creating a calculated column to identify students who have taken a Math class.

apply filter to your visual will display only students who have not enrolled in a Math class.

Below is the DAX formula for the calculated column.

HasTakenMath =
VAR CurrentStudent = 'Student_Class'[Student]
RETURN
IF(
CALCULATE(
COUNTROWS('Student_Class'),
'Student_Class'[Student] = CurrentStudent,
'Student_Class'[Class] = "Math"
) > 0,
TRUE(),
FALSE()
)

PBIX file attached.

 

ArwaAldoud_1-1741397798932.png

 

If this response was helpful, please accept it as a solution and give kudos to support other community members.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @Greenterer 

 

Crate a disconnected table containing the distinct classes:

danextian_0-1741440099296.png

danextian_1-1741440120365.png

Create the measure below and used it as a visual filter

Filter =
VAR _count =
    CALCULATE (
        COUNTROWS ( Student ),
        FILTER (
            ALLEXCEPT ( Student, Student[Student] ),
            Student[Class] = SELECTEDVALUE ( Class[Class] )
        )
    ) + 0
RETURN
    IF ( ISBLANK ( _count ), 1, _count )

danextian_2-1741440207799.png

danextian_3-1741440232252.png

danextian_4-1741440251612.pngdanextian_5-1741440266752.png

Please see the attached sample pbix.

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Ashish_Mathur_0-1741398674031.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ArwaAldoud
Super User
Super User

Hi @Greenterer 

You can achieve this by creating a calculated column to identify students who have taken a Math class.

apply filter to your visual will display only students who have not enrolled in a Math class.

Below is the DAX formula for the calculated column.

HasTakenMath =
VAR CurrentStudent = 'Student_Class'[Student]
RETURN
IF(
CALCULATE(
COUNTROWS('Student_Class'),
'Student_Class'[Student] = CurrentStudent,
'Student_Class'[Class] = "Math"
) > 0,
TRUE(),
FALSE()
)

PBIX file attached.

 

ArwaAldoud_1-1741397798932.png

 

If this response was helpful, please accept it as a solution and give kudos to support other community members.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.