Forum Discussion
Cross table Datediff
- 9 years ago
What’s the warning message when you try including “RELATED” in the calculate column expression?
If Event and Contacts table has relationship with the PersonID key, you should be able to get the desired result with following column formula.
Age = IF ( ISERROR ( DATEDIFF ( Event[Date], RELATED ( Contacts[DateOfBirth] ), YEAR ) ), DATEDIFF ( RELATED ( Contacts[DateOfBirth] ), Event[Date], YEAR ) )Best Regards,
Herbert
What’s the warning message when you try including “RELATED” in the calculate column expression?
If Event and Contacts table has relationship with the PersonID key, you should be able to get the desired result with following column formula.
Age =
IF (
ISERROR ( DATEDIFF ( Event[Date], RELATED ( Contacts[DateOfBirth] ), YEAR ) ),
DATEDIFF ( RELATED ( Contacts[DateOfBirth] ), Event[Date], YEAR )
)
Best Regards,
Herbert
What happens if the two tables only have an indirect relationship between them? like -------- (dotted) lines?
- S1840196 years agoAdvocate III
What about if there is no relationship at all. For example, how do I do a datediff between two completely independent tables? Let's say I want to make sure the tables refreshed on the same day. I would put a date in each table (sql) then I want to compare the dates from each table.
I am open to ideas, please?