Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I tried the below formulas to calculate the following:
Age as of 1st Jan 2020 =
YEARFRAC(DATE(2020,3,1),DATE(2020,1,1),1)
which is 0.16393443
Age as of 1st Jan 2021 =
YEARFRAC(DATE(2020,3,1),DATE(2021,1,1),1)
which is 0.83835616
When I add both 0.16393443+0.83835616 it is equal to 1.00229 something and is not 1.
What am I doing wrong? Please note I use YEARFRAC because I need the decimals and also I need to take into account of leap year.
----------------------------------------------------------------------------------------------------------------------
@parry2k @mahoney19 @parry2k @az38 @jdbuchanan71 @mahoneypat @edhans @harshnathani @v-kellya-msft @MFelix @Ashish_Mathur @BA_Pete @ryan_mayu @kbuckvol @Alexander76877 @Petazo @Mariusz @TomMartens @Greg_Deckler @tjd @Sean @mikstra @AllisonKennedy @EricHulshof @briandpeterson @USG_Phil @vpatel55 @mwegener @v-piga-msft @tex628 @sturlaws @Vvelarde @CheenuSing @MarcelBeug @Zubair_Muhammad @v-piga-msft @danextian @MattAL @MattAllington @roalexan @Alexander76877 @kgc
Hi @Kolumam ,
The YEARFRAC function will return a decimal number, which the internal data type is a signed IEEE 64-bit (8-byte) double-precision floating-point number. You may use ROUND function to limit the decimal places of data.
For reference: https://docs.microsoft.com/en-us/dax/yearfrac-function-dax.
Best Regards,
Amy
See if this helps:
https://www.sqlbi.com/blog/marco/2018/06/24/correct-calculate-of-age-in-dax-from-birthday/
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!