Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Formula for calculating number of months between two given dates

hubyh
7 - Meteor

I am trying to build a formula to establish the number of months between the start date of a project and the end date of the project.

 

With Start date of 2022-09-01 and end date 2023-08-31 that is 12 months, the formula I was using below, which I thought was correct, is calculating 11 months. Where am I going wrong with this?

 

DateTimeDiff([ProjectEndDate],[ProjectStartDate],"months")

4 REPLIES 4
DataNath
17 - Castor

Hey @hubyh, 11 is correct here, no? At 2023-08-31 only 11 full months have passed, 12 months would need the end date to be a day later i.e. 2023-09-01:

 

DataNath_0-1679570161367.png

Zok
8 - Asteroid

11 full months

(12-9)+8=11

With your logic, your birthday would be one day earlier each year

You should calculate the difference in days and divide it by 30 to be more precise

 

hubyh
7 - Meteor

Thank you DataNath

 

I am new to this, so this is going to cause a problem with my data.  Can I use this formula but get it to add 1 day to the end date ?  If so what would that formula be?

 

Zok
8 - Asteroid

Zok_0-1679575177614.png

 

Labels