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.
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
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 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |