ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula IN-DB Date and Prior Year date

paultno
Asteroide

Is it possible to translate this logic into the Formula IN-DB tool?  I keep running into errors!  Any help is appreciated!

 

if [DATE] < "2017-01-01" then DateTimeAdd([DATE],-366,"days") else DateTimeAdd([DATE],-365,"days") endif
2 RESPUESTAS 2
BenMoss
ACE Emeritus
ACE Emeritus

If you are using the IN-DB formula tool then the formulas you write must be specific to the language and method used by that database, most likely SQL.

 

According to this post it looks like the formula you need is DATEADD()

 

https://docs.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql?view=sql-server-2017

 

You would also have to specify your IF statement in SQL method.

 

https://docs.microsoft.com/en-us/sql/t-sql/language-elements/if-else-transact-sql?view=sql-server-20...

 

Ben

paultno
Asteroide

Thank you, those were helpful sources.  

Etiquetas
Autores con mayor cantidad de soluciones