Skip to main content

Notifications

Dynamics 365 general forum

how to create a calculated field which calculate the difference between years

Posted on by 385

I'm trying to create a calculated field which can calculate the number of years  the trick here is that my user enter only the year (yyyy) and not full date (dd/mm/yyyy) this is the first field year the second year is the current year so basically I need to create a calculated field which will calculate the number of years between the user year and the current year. 

I was trying to use function DIFFINYEARS :

DIFFINYEARS (ay_year, now())

but I'm getting an error saying that ay_year field is an integer field in cannot be implemented in this function.

now what would be my options here?  obviously it was easier if my users will enter a full date but unfortunately it is not necessary and they actually don't know the full date they know just the year - is there any function which I can extract the year from NOW() function and do a calculated field between two integers?

Thanks 

  • Suggested answer
    Drew Poggemann Profile Picture
    Drew Poggemann 9,079 on at
    RE: how to create a calculated field which calculate the difference between years

    Hi Alexyou,

    This is not possible without the other one being a date field.  I would suggest doing this in a workflow and using Jason Lattimer's date utils to accomplish.

    jlattimer.blogspot.com/.../updated-crm-workflow-utilities.html

    Hope this helps.

    Thanks,

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans