Alteryx Designer Desktop Discussions

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

Recreate formula in Alteryx from Excel - number of months amortizing in current year

Gmonaco
5 - Atom

Hi Alteryx Community,

 

I'm attempting to replicate a complex formula from Excel into Alteryx and I'm completely spinning my wheels trying to replicate this. The formula is to calculate the number of months a project has been amortizing in the current year using a project in-service date, the useful life of the project, the start of the year, and the remaining useful life (in months). 

 

I've attached the excel file with sample data and highlighted column E "Months Amortizing in Current Year" which contains the formula I'm trying to replicate and also attached an Alteryx workflow which contains the same excel file with a formula tool attached to the input data tool.

 

Any help replicating this formula is EXTREMELY appreciated!

 

Thank you!

3 REPLIES 3
Raj
14 - Magnetar

This will work

 

IIF([In-Service Date]<[Start of Year:],IIF([Useful Life (months)]-
DateTimeDiff([In-Service Date],[Start of Year:],"months")<0,0,([Useful Life (months)]-DateTimeDiff([In-Service Date],[Start of Year:],"months"))),[Useful Life (months)])-[Remaining Useful Life]

 

Raj_0-1685104900783.png

 

DavidSkaife
13 - Pulsar

Hi @Gmonaco 

 

Try this formula, the output matches what you have in the example file:

 

 

(IF [In-Service Date] < [Start of Year:]
AND ([Useful Life (months)] - DateTimeDiff([Start of Year:],[In-Service Date],'Months'))<0
THEN 0
ELSEIF [In-Service Date] < [Start of Year:]
THEN ([Useful Life (months)] - DateTimeDiff([Start of Year:],[In-Service Date],'Months'))
ELSE [Useful Life (months)]
ENDIF) - [Remaining Useful Life]

 

DavidSkaife_0-1685105298956.png

 

 

Gmonaco
5 - Atom

This is incredible! Thank you so much! 

 

Appreciate your help. 

 

 

 

 

Labels