Alteryx Designer Desktop Discussions

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

Date calculation with a workflow constant

ebuch
7 - Meteor

Hi,

 

I have a dataset with products with a maturity date and I need to see the difference between the date I set for running my analysis and the maturity date.

 

 

I'm running the dataset backwards, so I use workflow constants to create variables into e.g. SQL. 

So I want to be able to use the formula tool to e.g. [Maturitydate] - [Startdate]      -  Where startdate is a selfcreated constant workflow variable, e.g., 12Nov18 or 12/11/2018. 

 

Thanks in advance. 

5 REPLIES 5
NickC
Alteryx Alumni (Retired)

Hello ebuch,

 

Sounds like you could just use date time today in the formula tool?

 

The other option is you can enter a user constant on the 'workflow' tab as shown in the screenshot below.  This means you can just update one place and it can be used in multiple places within your workflow.

 

 

User Constant.png

 

 

Another trick is that you can create windows environment variables which can be called using GetEnvironmentVariables() .  More on that in this post  https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Reference-Windows-user-paths-or-other-enviro...

 

Nick

 

 

 

ebuch
7 - Meteor

I've created a workflow constant as you have shown in your reply. The question at hand, however, is how do I use this to find the difference between by maturitydate variable in my dataset and the constant date variable I've made in my workflow. 

NickC
Alteryx Alumni (Retired)

Hello,

 

See my workflow attached.

 

I have used a formula too using DateTimeDiff([User.DATE],[DateTimeNow],"days")

 

Thanks,

Nick

NickC
Alteryx Alumni (Retired)

Hello,

 

See my workflow attached.

 

I have used a formula tool using DateTimeDiff([User.DATE],[DateTimeNow],"days")

 

Thanks,

Nick

ebuch
7 - Meteor

Thank you! This solved my problem :) 

Labels