This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi folks,
I'm working in SQL Analysis Services, Live Connection.
My goal is to calculate the enrolment in a course, at various times through the semester. For example, at 1wk after start of course, midpoint of the course, and end of the course. However, the start and end dates change each year.
The data is organized as follows:
| 'StudentTimeTable' | |||
| [StudentID] | [SchoolYear] | [StartDate] | [EndDate] |
As well, in a separate table in the model (but not incorporated in my measure below):
| 'SchoolSchedule' | |||
| [SchoolYear] | [Semester] | [SemesterStartDate] | [SemesterEndDate] |
I have created this measure for 1wk after the start of the course which works (for past three years and involves manually coding the 1wk date), but I'm sure there is a better way to do this using variables and incorporating the SchoolSchedule table.
| Course | Year | Semester Start Date | Enrolment@1wk |
| ABC | 20182019 | 2/4/2019 | 22 |
| ABC | 20192020 | 2/3/2020 | 27 |
| DEF | 20182019 | 2/4/2019 | 24 |
| DEF | 20202021 | 2/2/2021 | 18 |
| XYZ | 20182019 | 2/4/2019 | 12 |
| XYZ | 20192020 | 2/3/2020 | 25 |
| XYZ | 20202021 | 2/2/2021 | 4 |
I'm still learning DAX and was hoping someone with more experience could show a better way to write the measure that makes use of the SchoolSchedule table, and allows for flexibility to work with all years and all SemesterStartDate and SemesterEndDates.
Thanks
Solved! Go to Solution.
Please supply good examples of your live data. The two first 'tables' are not very informative. Also, please show us the model. DAX can't be written in a vacuum.
Please supply good examples of your live data. The two first 'tables' are not very informative. Also, please show us the model. DAX can't be written in a vacuum.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 9 | |
| 9 | |
| 7 | |
| 6 | |
| 6 |