Forum Discussion
Count Student Starts per month
- 1 year ago
Ji Elisa112 ,
Your DAX expression is trying to evaluate a text value ('Jul 2024') as if it were a Boolean (True/False)—likely due to a line such as:
Student[Status] = "Enrolled"being used outside of a filter function like FILTER() or CALCULATE(), or directly in a context where Power BI expects a Boolean expression.
To Fix It:
Please use CALCULATE to apply filters properly. Here's how to rewrite the measure correctly:Measure 1: Student Starts
Student Starts = CALCULATE( DISTINCTCOUNT(Student[StudentID]), FILTER( Student, Student[Status] = "Enrolled" ) )
If you're grouping by 'Date'[MonthYear], make sure Date is the active date table and is properly related to Student[StartDate].You can add KEEPFILTERS('Date'[MonthYear]) if you're seeing issues with slicers not respecting the context.
Optional: Add a helper column for clarity (if needed)
If you're manually matching 'Jul 2024', it's better to create a MonthYear column like this in your Date table:MonthYear = FORMAT('Date'[Date], "MMM YYYY")
Then use that column in your visual's axis or rows.Double-check:
Student[StartDate] must be properly linked to Date[Date].You should not directly compare 'Jul 2024' to fields unless they're of the same type (Text vs Date).
Ji Elisa112 ,
Your DAX expression is trying to evaluate a text value ('Jul 2024') as if it were a Boolean (True/False)—likely due to a line such as:
Student[Status] = "Enrolled"
being used outside of a filter function like FILTER() or CALCULATE(), or directly in a context where Power BI expects a Boolean expression.
To Fix It:
Please use CALCULATE to apply filters properly. Here's how to rewrite the measure correctly:
Measure 1: Student Starts
Student Starts =
CALCULATE(
DISTINCTCOUNT(Student[StudentID]),
FILTER(
Student,
Student[Status] = "Enrolled"
)
)
If you're grouping by 'Date'[MonthYear], make sure Date is the active date table and is properly related to Student[StartDate].
You can add KEEPFILTERS('Date'[MonthYear]) if you're seeing issues with slicers not respecting the context.
Optional: Add a helper column for clarity (if needed)
If you're manually matching 'Jul 2024', it's better to create a MonthYear column like this in your Date table:
MonthYear = FORMAT('Date'[Date], "MMM YYYY")
Then use that column in your visual's axis or rows.
Double-check:
Student[StartDate] must be properly linked to Date[Date].
You should not directly compare 'Jul 2024' to fields unless they're of the same type (Text vs Date).
thank you for your time, I am now trying to find only students that have passed in that months intake, for example students 20 enrolled in January 2024, but only 15 passed. This will give a more accurate picture of each cohort intakes success rate.
Any suggestions greatly appreciated
thanks