Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
109 | |
89 | |
76 | |
66 |
User | Count |
---|---|
126 | |
112 | |
99 | |
82 | |
73 |