Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe 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
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.
Solved! Go to Solution.
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()
)
If this response was helpful, please accept it as a solution and give kudos to support other community members.
Hi @Greenterer
Crate a disconnected table containing the distinct classes:
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 )
Please see the attached sample pbix.
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()
)
If this response was helpful, please accept it as a solution and give kudos to support other community members.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 38 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 34 | |
| 33 | |
| 30 |