Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi All,
I am looking for some help adding a column to my date table based on date start and end found in another table.
What I am trying to do is to add a column to my date table which specifies for each date in the table, which semester it falls into. The dates for each semester can be found in the Semester Date table. There is a start and end date for each semester.
I have tried to adapt the solution found in another post. The issue I am having is that the column is currently only returning the final semester found in the Semester Date table.
The DAX I have is
Semester Date = VAR _a =
SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE (
MAX( 'Semester Dates'[Academic Semester]),
FILTER (
ALL ( 'Semester Dates' ),
'Semester Dates'[Start]>= _a
&& _a <= 'Semester Dates'[End]
)
)
Date Table;
Semester Date Table;
Any help would be greatly appreciated.
Many thanks
Solved! Go to Solution.
Thank you very much for your response. I have made an adjustement to my original code and have had success with the SELECTEDVALUE
Semester Date = VAR _a =
SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE(
MAX('Semester Dates'[Academic Semester]),
FILTER(
'Semester Dates',
[Date] >= 'Semester Dates'[Start] &&
[Date] <= 'Semester Dates'[End]
)
)
I aslo found some issues with the dates in my Semester Dates Table, which I have addressed and is working correctly now.
Thank you for the help.
SELECTEDVALUE won't work in a calculated column, you can use
Semester Date =
VAR _a = 'Date'[Date]
RETURN
CALCULATE (
MAX( 'Semester Dates'[Academic Semester]),
FILTER (
ALL ( 'Semester Dates' ),
'Semester Dates'[Start]>= _a
&& _a <= 'Semester Dates'[End]
)
)
Thank you very much for your response. I have made an adjustement to my original code and have had success with the SELECTEDVALUE
Semester Date = VAR _a =
SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE(
MAX('Semester Dates'[Academic Semester]),
FILTER(
'Semester Dates',
[Date] >= 'Semester Dates'[Start] &&
[Date] <= 'Semester Dates'[End]
)
)
I aslo found some issues with the dates in my Semester Dates Table, which I have addressed and is working correctly now.
Thank you for the help.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
18 | |
12 | |
12 | |
8 | |
6 |
User | Count |
---|---|
26 | |
16 | |
12 | |
12 | |
10 |