Forum Discussion

DominicBrien's avatar
DominicBrien
Frequent Visitor
9 years ago
Solved

Cross table Datediff

Hello, Lets say I have a person table where I can find date of birth for every person in the system. I also have an event table where I can find the date an event occured at and another field that ...
  • v-haibl-msft's avatar
    9 years ago

    DominicBrien

     

    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