Forum Discussion

Danny-Happy's avatar
Danny-Happy
Icon for Helper I rankHelper I
2 years ago
Solved

Age based on selected date

Hi All,

 

I want to see the age of our employees on a chosen date in a filter(so not today).
I got a table with employee name an DOB and a calender table.
Which measure should I use?

 

Many thanks!

  • lukiz84's avatar
    lukiz84
    2 years ago

    thx, you have to remove the relationship between Date and DOB. Otherwise Date filters Employee and shows only the people that had a birthday ON THE SELECTED DATE.

5 Replies

  • lukiz84's avatar
    lukiz84
    Icon for Memorable Member rankMemorable Member
    Age =
    VAR SelectedDate = SELECTEDVALUE(DateTable[Date])
    VAR SelectedDOB = SELECTEDVALUE(Employees[DOB])
    
    RETURN DATEDIFF(SelectedDOB, SelectedDate, YEAR)
      • lukiz84's avatar
        lukiz84
        Icon for Memorable Member rankMemorable Member

        thx, you have to remove the relationship between Date and DOB. Otherwise Date filters Employee and shows only the people that had a birthday ON THE SELECTED DATE.