Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
57 | |
36 | |
31 |
User | Count |
---|---|
91 | |
60 | |
60 | |
49 | |
45 |