Alteryx Designer Desktop Discussions

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

Input Data - with Current vs Previous month

suby
11 - Bolide

All,

 

I have a shared directory where I have all daily files are stored , 

 

For the Dynamic read.

 

1) Firstly I need to pick two files ( say 1st of March and 1st of April File) and do a comparison.

2) Secondly i want the flow to be dynamic say when i am in May i want to pick  (1st of April File and 1st of May file) and do a comparison.

 

the first thing I'm trying to attempt is making the read to automatically to pick the files.

Also i  need to compare two data sets and make this dynamic so I need  the dates like current vs previous to build logic in my flow.

 

Sample Dir/Files

 

xxxx_xxx_xx-xx2021-02-28xxxxxx.xlsx
xxxx_xxx_xx-xx2021-03-01xxxxxx.xlsx
xxxx_xxx_xx-xx2021-03-02xxxxxx.xlsx
xxxx_xxx_xx-xx2021-04-01xxxxxx.xlsx
xxxx_xxx_xx-xx2021-04-02xxxxxx.xlsx

 

 

Many thanks

11 REPLIES 11
apathetichell
19 - Altair

Here's the datetime code to take today's date and get the first of last month, and the first of the previous month:

datetimeadd(datetimetoday(),-tonumber(datetimeformat(datetimetoday(),"%e"))+1,"days")

 

and:

datetimeadd(datetimeadd(datetimetoday(),-tonumber(datetimeformat(datetimetoday(),"%e"))+1,"days"),-1,"months")

 

You add these fields in a formula tool (with tostring() to convert them into strings) into placeholders on your filenames in a formula tools to dynamically generate the file names.

shreyanshrathod
11 - Bolide

Hi @suby ,

 

Hope this helps.

 

Note that the Regex pattern for extracting the file name from the path will depend on your directory path.

 

Regards,

Shreyansh Rathod

suby
11 - Bolide

Hi 

 

Thanks but unable to open the zip file and it says the below message and even when i click ok any thoughts?

 

This workflow was created by a more recent version of Alteryx, and may contain tools or functionality not present in this version. Alteryx does not support using an earlier version of Alteryx to open a workflow created with a newer version. For best results, download the latest version of Alteryx.

Do you still want to attempt to open the workflow?

shreyanshrathod
11 - Bolide

Hi @suby ,

 

It's the version error. My alteryx version is higher than yours.

Although, I feel you shoulod be able to load the '.yxmd' that I am attaching with this comment.

 

Cheers

apathetichell
19 - Altair

you can open the workflow in notepad and manually edit the version - then save. note much of notepad will be junk but the version is editable text.

suby
11 - Bolide

Hello,

 

Thanks for your reply and could you please what this Regex function will do.

 

.*_(\d{4}_\d{2}_\d{2}).*

 

In my files I have multiple tabs and i 'm interested on couple of tabs for my analysis so just to clarify on the Dynamic Input tool should i need to choose a one tab as template. 

 

What happens if my tabs have different column structure for different months.

 

Many thanks

apathetichell
19 - Altair

That regex function matches a date in the yyyy_mm_dd format.

shreyanshrathod
11 - Bolide

If your tabs have different column structures, then you might need to build a batch macro for the same.

 

Dynamic input tool will throw an error in case of structure mismatch.

suby
11 - Bolide

Thanks

 

Any thoughts or pointers for batch macro.

Labels