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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 171 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 83

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans