Alteryx Designer Desktop Discussions

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

How to rename output based on running month -1?

kennynsw
5 - Atom

I need to create some output files based on running months (i.e Jan to Dec). However, e.g. i have Jun actual data only in Jul, so today_date function do not fit in when i renaming my file through formula tool. Any good suggestions? I would want my output file name will dynamically changed based on actual data month instead of today, but i do not have the data month field available in the data set. 

3 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

Hi @kennynsw 

 

If you know that you will always have the previous month's data in the current month. You can calculate the previous month from the current month like below.

 

Workflow:

atcodedog05_0-1625324867453.png

 

I hope this gives you an idea.

 

Hope this helps 🙂

 

kennynsw
5 - Atom

May i ask what option i should choose in output tool? 
I ticked take field from field name and change entire output path by choosing my output path file column created.

However, “writing to database” that field cannot dynamically take my output file path. I need to manually type my file name, does it mean that i need to change the path every month? 

atcodedog05
22 - Nova
22 - Nova

Hi @kennynsw 

 

File Name column formula would be something like below.

 

// FullPath & FileName
"Output" 

// Month
+ DateTimeFormat(
DateTimeAdd(DateTimeFirstOfMonth(),-1,"month")
,"%B %Y")+".xlsx"

//SheetName
+"|||Sheet1"

 

In Output tool you just need to set a temp file. This will be taken reference for file options. Set it change path of the file name and it will output the mentioned filename.

atcodedog05_0-1625476610791.png

 

Hope this helps 🙂

Labels