Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I want to get the distinct count of the StudentName that DOES NOT contain a record with the keyword "Withdrawn". So the DAX formula result for the data below should have a single count for each student's name except for Richard Gear because he has the keyword "Withdrawn" in one of his records. Also, there is a calendar table. If the formula can include filters by date so I can use a slider. The records should be within the MIN() and MAX() of the Calendar Table.
DATA:
RESULT:
Solved! Go to Solution.
Hi @MickyG ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _min=MINX(ALLSELECTED('Date'),[Date])
var _max=MAXX(ALLSELECTED('Date'),[Date])
return
IF(
CONTAINSSTRING(MAX('Table'[Result]),"Withdrawn")=FALSE()&&
MAX('Table'[Exam Date])>=_min&&MAX('Table'[Exam Date])<=_max,1,0)
Measure =
CALCULATE(DISTINCTCOUNT('Table'[StudentName]),
FILTER(ALLSELECTED('Table'),
'Table'[StudentName]=MAX('Table'[StudentName])))
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
Create a calculated column formula
Test = search("Withdrawn",Data[Results],1,0)
To your visual, drag Name and this measure
Measure = calculate(countrows(Data),Data[Test]=0)
Hope this helps.
Hi @MickyG ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _min=MINX(ALLSELECTED('Date'),[Date])
var _max=MAXX(ALLSELECTED('Date'),[Date])
return
IF(
CONTAINSSTRING(MAX('Table'[Result]),"Withdrawn")=FALSE()&&
MAX('Table'[Exam Date])>=_min&&MAX('Table'[Exam Date])<=_max,1,0)
Measure =
CALCULATE(DISTINCTCOUNT('Table'[StudentName]),
FILTER(ALLSELECTED('Table'),
'Table'[StudentName]=MAX('Table'[StudentName])))
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.