Forum Discussion
Calculated Column Based on a DateTime event in a DateTime Range
- 6 years ago
Anonymous
Sure. You're right
Role = CALCULATE ( DISTINCT ( Table1[Role] ), FILTER ( Table1, Table1[ValidFromDateTime] <= Table2[EventDateTime] && ( Table1[ValidToDateTime] > Table2[EventDateTime] || ISBLANK ( Table1[ValidToDateTime] ) ) && Table1[ID] = Table2[ID] ) )Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers

Hi Anonymous
You should explain the logic behind Role, not just what the result is. Otherwise we have to guess. Try this for your calculated column:
Role =
CALCULATE (
DISTINCT ( Table1[Role] ),
FILTER (
Table1,
Table1[ValidFromDateTime] <= Table2[EventDateTime]
&& ( Table1[ValidToDateTime] > Table2[EventDateTime] || ISBLANK ( Table2[EventDateTime] ) )
&& Table1[ID] = Table2[ID]
)
)
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers ![]()
- Anonymous7 years agoNot applicable
Hi AIB,
Thanks for your response. In your response, shouldn't the ISBLANK part be:
ISBLANK ( Table1[ValidToDateTime] )
?Regarding the logic of role, the role is the person's role when the event occured.
Thanks,
Trystan.- Anonymous7 years agoNot applicable
AlBPlease see my reply above.
- AlB6 years ago
Community Champion
Anonymous
Sure. You're right
Role = CALCULATE ( DISTINCT ( Table1[Role] ), FILTER ( Table1, Table1[ValidFromDateTime] <= Table2[EventDateTime] && ( Table1[ValidToDateTime] > Table2[EventDateTime] || ISBLANK ( Table1[ValidToDateTime] ) ) && Table1[ID] = Table2[ID] ) )Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
