The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I am trying to create a DAX formula that will count the number of students on roll in a school last school year specifically on 2MAY24.
Gemini has offered the below but I'm getting a The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column error.
Hi ALL
Firstly Poojara_D12 and lbendlin thank you for your solution!
And @karenHO ,The problem you encountered seems to be because ACADEMIC_CALENDAR_DATES[STUDENT_ON_ROLL] is referenced twice in the dax and is assigned a different value, I tried to improve your DAX as follows, I hope that helps you.
KH Students on Roll 23/24 =
CALCULATE (
COUNTROWS ( Student_School_Enrollments_Data ),
Academic_Calendar_Dates_Data[DATE] = DATE(2024, 5, 2),
Academic_Calendar_Dates_Data[STUDENT_ON_ROLL] = TRUE,
Student_School_Enrollments_Data[CURRENTLY_ON_ROLL] = TRUE
)
If you have more recent questions, you can check my pbix file to see if my example data meets your expectations, and I would be honored if my solution solves your problem!
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi Thanks for this.
I have used the below formula but I am now getting an error - A function 'PLACEHOLDER' has been used in a True/Fasle expression that is used as a table filter expressions. This is not allowed.
Any ideas?
Hi @karenHO
Can you please try the below dax:
KH Students on Roll 23/24 =
CALCULATE(
COUNTROWS(STUDENT_SCHOOL_ENROLEMENTS), -- Counts students currently on roll
STUDENT_SCHOOL_ENROLEMENTS[CURRENTLY_ON_ROLL] = TRUE, -- Filters students currently on roll
ACADEMIC_CALENDAR_DATES[DATE] = DATE(2024, 5, 2) -- Filters for the specific date 2-May-2024
)
Please let me know if it works for you.
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Please Subscribe my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
This one has sort of worked, however it is only bringing those students who were 'currently on roll' on 2MAY24.
I want to know all students that were 'currently on roll' on 2MAY24, not just those that were first enrolled on 2MAY24.
any ideas?
You cannot use HASONEVALUE in that situation.
Instead, create a table variable that applies your filters, and adds the number of "currently on roll") field. Then filter that table variable by the field being equal to 1, and then return the countrows of that.
User | Count |
---|---|
25 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |