Forum Discussion
Anonymous
7 years agoNot applicable
Calculated Column Based on a DateTime event in a DateTime Range
Hi PowerBI DAX Experts, I have a table with fields: PersonID, Role, ValidFromDateTime and ValidToDateTime. If the person's role is currently valid then the ValidToDateTime is blank (null). ...
- 7 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

Anonymous
7 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.
Anonymous
7 years agoNot applicable
AlBPlease see my reply above.
- AlB7 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
