Forum Discussion

melhajj's avatar
melhajj
Helper I
6 years ago
Solved

How to Calculate Age dynamically

Greetings Community,   I have a table that contains Employee Number, Hire Date, Date of Birth and Age. The "Age" column reflects the age as of today i.e. Current Date - Date of Birth   I have add...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi melhajj ,

     

    Refer this measure.

    Measure = 
    var a = YEAR(TODAY())-YEAR(SELECTEDVALUE('Table'[Date of Birth]))
    return
    IF(ISFILTERED(slicer[year]),a-(YEAR(TODAY())-SELECTEDVALUE(slicer[year])),a)

    Result would be shown as below.

     

     

    Best Regards,

    Jay