Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Calculated field to take into consideration leap years

Posted on by 1,760

Has anybody done this before?

I'm not sure where to start formula wise in the calculated field. 

  • Suggested answer
    Nya Profile Picture
    Nya 29,054 on at
    RE: Calculated field to take into consideration leap years

    Hi,

    Now I know your proposal.

    You can refer to the answer to the following issue.

    (+) How to get Accurate Age including leap year calculations? - Microsoft Dynamics CRM Forum Community Forum

  • T.I.A Profile Picture
    T.I.A 1,760 on at
    RE: Calculated field to take into consideration leap years

    Hi, NVA.

    If the birthday is the 29/02/2000 and the next birthday is in 2024 it will be calculated as

    28/02/2024 which is slightly off. A leap year has 366 days not 365 so adding 1 year will fail.

  • Suggested answer
    Nya Profile Picture
    Nya 29,054 on at
    RE: Calculated field to take into consideration leap years

    Hi,

    I have tested the following three date with the similar expression. There is no need to consider the leap years.

    pastedimage1633594480008v1.pngpastedimage1633594485751v2.pngpastedimage1633594490660v3.png

  • T.I.A Profile Picture
    T.I.A 1,760 on at
    RE: Calculated field to take into consideration leap years

    Lets say a contact was born on 29/02/1992, this year there was no 29/02/2021, so what should i be setting the date to?

    my formula is AddYears(1, new_nextbirthday)

  • Nya Profile Picture
    Nya 29,054 on at
    RE: Calculated field to take into consideration leap years

    Hi,

    Would you please specify in what scenarios do you need to perform calculations for leap years?

    Based on my test, if you simply add up the years to the calculation fields, there will be no calculation errors due to leap years.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans