We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Select columns dynamically based on current month

bhanus
5 - Atom

Hi,

 

I have columns Jan to Dec along with some other columns. I need to do current month - previous month to see if there is a change and pick that row in filter tool.

 

For example, if current month is May, then I need to pick May and Apr columns from Jan to Dec. How can I achieve this dynamically based on current month?

 

Thanks in advance.

6 REPLIES 6
alexnajm
18 - Pollux
18 - Pollux

Dynamic Select is your best bet! Not sure what your columns look like so it's hard to help further, but TLDR you can use logic to select certain columns with this tool in a dynamic way

gawa
16 - Nebula
16 - Nebula

@bhanus As @alexnajm suggested, Dynamic Select tool will do.

For example, by using text input tool having following mapping data, rename header name to number(January => 1, February => 2...) by Dynamic Rename tool.

image.png

In Dynamic Select tool configuration, set the following expression so as to pass the columns which is the current or later month.

ToNumber([Name])>=ToNumber(DateTimeFormat(DateTimeToday(), "%m"))

 After that, rename the header to the original format by another Dynamic Rename tool.

 

Overall WF looks like this.

image.png

Qiu
21 - Polaris
21 - Polaris

@bhanus 
A bit late for the party. 😁
I will go with the Dynamic Select tool and I understand that you only want to keep the Col "May" and "April"  in case running worflow today.

Baselly I just use the DateTime function to convert the column of month, "Jan", "Feb" to number of Month, then compare with the month of "DateTimeToday()".
I also add a mapping file at the end, since the column name would be dynamic, we should map the column name in order to do the calculation for difference.

0528-bhanus.png0528-bhanus-A.png

bhanus
5 - Atom

Thanks Alex,

 

The Columns are like Jan-24, Feb-24, Mar-24.....Dec-24. I need to do current month - previous month and if there is a change then I will pick that row using filter tool.

bhanus
5 - Atom

Thanks Alex,

The Columns are like Jan-24, Feb-24, Mar-24.....Dec-24. I need to do current month - previous month and if there is a change then I will pick that row using filter tool.

Qiu
21 - Polaris
21 - Polaris

@bhanus 
If they are like Jan-24, Feb-24, Mar-24., we can just add another identifier as below/

0528-bhanus-r1.png

Labels
Top Solution Authors