Forum Discussion
BeenBee
1 year agoNew Member
Adding Calculated Column to Date Table based on Date Ranges in Another table
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 fo...
- 1 year ago
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.
johnt75
1 year agoSuper User
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]
)
)- BeenBee1 year agoNew Member
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.