Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Kolumam
Post Prodigy
Post Prodigy

Age in Years between two dates

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 

2 REPLIES 2
v-xicai
Community Support
Community Support

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 

AlB
Community Champion
Community Champion

 @Kolumam 

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 

 

SU18_powerbi_badge

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors