March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I am trying to compare year over year data for enrollments for this school year and the last two school years. The school calendar starts on July 1 and ends on June 30th. I have a dates table where July is numbered 1, August 2, etc.
My desired result is a table like the below:
Enrollments | |||
Program | 2016 | 2017 | 2018 |
Program 1 | 5 | 3 | 5 |
Program 2 | 2 | 4 | 5 |
Program 3 | 3 | 4 | 4 |
where the enrollments shown for each year are the enrollments up to month of the max enrollment date in the enrollment table (i.e. the last enrollment captured).
I've tried a measure like this:
[Enrollments To Date] =
VAR MaxDate = -- i would like this to be outside all filter contexts, i.e. to just find the month number for the max date in the Enrollments table. this is not working.
CALCULATE (
MAX ( Dates[MonthNumber] ),
FILTER (
ALL ( Enrollments[StartDate] ),
Enrollments[StartDate]
= MAX ( Enrollments[StartDate] )
)
)
VAR EnrollmentsToDate =
CALCULATE (
COUNT ( Enrollments[StudentID] ),
Dates[MonthNumber] <= MaxMonth
)
RETURN
EnrollmentsToDate
but this gives me the whole year's enrollments for each year rather than just the enrollments through October (the max month in the Enrollments table).
Last note is that there is a relationship between the StartDate column in the Enrollments table and the Date column in Dates. Thanks a lot!
Hi michaelccdf,
Could you please share the raw data and your origin table for further test? (Do mask the sensitive data in your table)
Regards,
Jimmy Tao
Thanks for the reply. Enrollments and Dates tables are in different tabs here. I would like to see the count of enrollments by program for each school year up to the max month number of the enrollments table. For the sample data below, the last record in the Enrollments table is 10/1/2018, month number 4. So the desired result would show the count of enrollments up to month number 4 for each school year.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
87 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |