Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Dynamically selecting column

Meenssankar
6 - Meteoroid

Hi,

 

I have been working on workflow which is having column from Jan to Dec. I need to pickup current month. For instance , if current month is July it should pickup only July values. 

 

Column name will be like SUMOFCY01,SUMOFCY02...till SUMOFCY12. If it is JUly, then it should pick up 'SUMOFCY07'

 

Thanks

6 REPLIES 6
atcodedog05
22 - Nova
22 - Nova

Hi @Meenssankar 

 

You can use dynamic select like below. Since the current month is 08 it's selecting column name ending with 08.

 

Workflow:

atcodedog05_0-1629995289632.png

 

Hope this helps : )

 

Meenssankar
6 - Meteoroid

That really helps! However, It should select previous month like if it is AUG , it should be JUly SUMOFCY07. Also, same data set also having SUMOFPY01,SUMofPY02...In this case, it will give both SUMOFPY08,SUMOFCY08. But I need CY08 only.

 

 Fields :

 

Banker ProductCategory SumOfPY01 SumOfPY02 SumOfPY03 SumOfPY04 SumOfPY05 SumOfPY06 SumOfPY07 SumOfPY08 SumOfPY09 SumOfPY10 SumOfPY11 SumOfPY12 SumOfCY01 SumOfCY02 SumOfCY03 SumOfCY04 SumOfCY05 SumOfCY06 SumOfCY07 SumOfCY08 SumOfCY09 SumOfCY10 SumOfCY11 SumOfCY12 Segment Sales_Region

Meenssankar
6 - Meteoroid

Right([Name], 2) =
Padleft(Tostring(DateTimeMonth(DateTimeNow())-1),2,"0") 

 

I used the above one and I am getting previous month data. However, there is a prefix 'SUMOFCY' . How to add that in the formulae.

atcodedog05
22 - Nova
22 - Nova

Hi @Meenssankar 

 

Update formula like below.

 

 

 

Right([Name], 2) =
Padleft(Tostring(DateTimeMonth(DateTimeNow())-1),2,"0") 

and

Contains([Name],"CY")

 

 

 

Workflow:

atcodedog05_0-1629996371713.png

 

Hope this helps : )

 

Meenssankar
6 - Meteoroid

That's so quick and works well. Many Thanks.

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @Meenssankar 

Cheers and have a nice day!

Labels
Top Solution Authors