community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Date time function

Meteoroid

Hi - I need a help in formulating difference between two dates in Alteryx.

 

I have the formula : =MONTH($AB$1)-MONTH(AB23006)+(YEAR($AB$1)-YEAR(AB23006))*12 in excel, this formula will give difference between two dates in a number format.

 

could anyone help how can i formulate this in Alteryx. 

Alteryx Partner

Hi @phemala1 ,

 

You can use the ' DateTimeDiff(dt1,dt2,u) ' formula for that.

 

Just set   DateTimeDiff([DateEND],[DateSTART],"months")

 

cheers

Meteoroid

Thanks a lot. Yes i used the same formula only and tried in alteryx.

I'm comparing a constant date 04/30/2019 with different dates like 05/15/2019, 06/01/2019 i should get a result of 1 , 2 respectively. But when use the formula  DateTimeDiff([DateEND],[DateSTART],"months") all I'm getting in one month lag.

 

i have attached the excel out of the formula used which does not gives the proper result with that of expected result.

Kindly do the needful. 

Highlighted
Alteryx Partner

Hi @phemala1 ,

 

Use this then:

 

DateTimeMonth([Period])-DateTimeMonth([Aging from])+(DateTimeYear([Period])-DateTimeYear([Aging from]))*12+1

 

cheers

Meteoroid

Thanks a lot for your swift responses. It works. :) Cheers.

Labels