Forum Discussion
bourne2000
Helper V
5 years agoError in calculating Age column?
Hi
I am having Birthdate and calculated age in Power query using Durations. Most of the ages are correct. However, some of the year the age is coming wrong. Please see the snapshot.
If you see the screenshot, the year 1951 appears multiple times, and the age calculated wrongly. This shows age 140, 210, some of the records it calculated correctly.
Could you please advise what went wrong?
bourne2000
I am not sure what calculation you used to get the age, anyhow, you can add the following code as a new custom column to calculate the correct age in years:=Number.RoundDown( Number.From( (Date.From(DateTime.LocalNow()) - [BirthDate] ) /365.25), 0 )
1 Reply
- Fowmy
Super User
bourne2000
I am not sure what calculation you used to get the age, anyhow, you can add the following code as a new custom column to calculate the correct age in years:=Number.RoundDown( Number.From( (Date.From(DateTime.LocalNow()) - [BirthDate] ) /365.25), 0 )