Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello,
I hope some can help.
I have some calculation that calculate a persons age based on two columns. I create a custom column with the following measure:
[Report Date] - [Birthdate]
This gives a column with the number of days between - this figure produced looks correct. I then add another column changing the days to years using the Time function to change the days to years - this then gives and incorrect figure because it simply divides the days by 365 not taking into account leap years etc.
For example
[30/04/2022] - [13/05/1962] = 21902 days. His age on 30/04/2022 should be 59 but the days to years does the following:
21902/365 = 60.005
Any help getting a more accurate figure would be much appreciated.
Thanks,
Bfaws
Solved! Go to Solution.
use this dax formula :
use this dax formula :
Many thanks works perfectly for 59 years
Hello! Have you tried using the DAX-function DATEDIFF? I think this should be able to give you the value you want: DATEDIFF([Report Date],[Birthdate],YEAR)
Edit: actually it looks like datediff rounds up, so you would have to round down the result. You might be able to find additional ways of dealing with this in the following thread: Solved: Age and Age intervals, 3 questions - Microsoft Power BI Community
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
80 | |
53 | |
39 | |
39 |
User | Count |
---|---|
104 | |
85 | |
47 | |
44 | |
43 |