Forum Discussion
melhajj
6 years agoHelper I
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...
- Anonymous6 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
Anonymous
6 years agoNot applicable
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
prash7882
5 years agoNew Member
I am also trying to calculate age dynamically for solar sites with their date of completetion. I want to age to refect based on the slicer year selection. In the below formula , I am not able able understand what is the "slicer[year] and "a" . my tables has only 2 columns site name and date for completetion. please help , i m new to power BI
Measure =
var a = YEAR(TODAY())-YEAR(SELECTEDVALUE('Table'[Date of Birth]))
return
IF(ISFILTERED(slicer[year]),a-(YEAR(TODAY())-SELECTEDVALUE(slicer[year])),a)