web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Calculate difference in months from seperate month and year field

(0) ShareShare
ReportReport
Posted on by 53
Hi
I want to make a calculative field which capture the difference in months between two dates.
 
I have 4 separate fields namely Exp. Project Start month,  Exp. Project Start Year, Exp. Project End month, Exp. Project End Year.
 
//
 
My requirement is to create a new calculated field which capture difference in months based on above four fields.
For Ex. For above case calculated field should return 14 (For start month we consider 1st date of the month and for end month we consider last date of the month. Hence the result is 14 months).

Please help how to achieve this.  
I have the same question (0)
  • Suggested answer
    Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    Unfortunately, this cannot be implemented using the calculated column.
    You can use the Fx formula column to implement this.
    The formulas are as follows.
     
    The formula first determines whether Exp. Project End Year is greater than or equal to Exp. Project Start Year.
    The Switch function converts the two month field values to corresponding numbers.
    Use the Text function to convert the date difference to a number, and then use the Concatenate function to add custom text to the difference.
     
    If('Exp. Project End Year'>='Exp. Project Start Year',Concatenate(Text(('Exp. Project End Year'-'Exp. Project Start Year')*12-Switch('Exp. Project Start month',
        "Jan",1,
        "Feb",2,
        "Mar",3,
        "Apr",4,
        "May",5,
        "Jun",6,
        "Jul",7,
        "Aug",8,
        "Sep",9,
        "Oct",10,
        "Nov",11,
        "Dec",12)+Switch('Exp. Project End month',
        "Jan",1,
        "Feb",2,
        "Mar",3,
        "Apr",4,
        "May",5,
        "Jun",6,
        "Jul",7,
        "Aug",8,
        "Sep",9,
        "Oct",10,
        "Nov",11,
        "Dec",12)+1,"#")," months"))
     
    The final result is shown below.
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     
  • Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    Has the issue been solved?
    Have there been any updates? Please feel free to ask me if you have any questions!
    If it has been resolved, can you mark the response as an answer?
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 151 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 134

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 55 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans