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.
SOLVED

Dynamic Select; Select columns that contain a match to data in another field

J-Riedel
8 - Asteroid

Hi,

I have a dataset that has multiple columns for each of the 4 quarters in the year, along with a field that shows the current quarter.  I am looking for a way to dynamically select the columns based on the Q# that is in the current quarter field.  I was thinking that I could do a Dynamic Select and use a formula, but I am unsure of what formula to use to try and match a portion of the column name to the data in another column.  Below and also in the attached file is my data, along with the view of the results that I am trying to achieve.  Any suggestions on how this can be done?

Thanks in advance!

 

DATA:             
Activity ClassificationQ1 QTD-Current Qtr AvgQ1 QTD-Prior Qtr-AvgQ1 QTD-Total AvgQ2 QTD-Current Qtr AvgQ2 QTD-Prior Qtr-AvgQ2 QTD-Total AvgQ3 QTD-Current Qtr AvgQ3 QTD-Prior Qtr-AvgQ3 QTD-Total AvgQ4 QTD-Current Qtr AvgQ4 QTD-Prior Qtr-AvgQ4 QTD-Total AvgCurrent Qtr
Activity 1257[Null][Null][Null][Null][Null][Null][Null][Null][Null]Q4
Activity 2134[Null][Null][Null][Null][Null][Null][Null][Null][Null]Q4
Activity 34913[Null][Null][Null][Null][Null][Null][Null][Null][Null]Q4
Activity 415520[Null][Null][Null][Null][Null][Null][Null][Null][Null]Q4
Activity 1[Null][Null][Null]22628[Null][Null][Null][Null][Null][Null]Q4
Activity 2[Null][Null][Null]73239[Null][Null][Null][Null][Null][Null]Q4
Activity 3[Null][Null][Null]8816[Null][Null][Null][Null][Null][Null]Q4
Activity 4[Null][Null][Null]88997[Null][Null][Null][Null][Null][Null]Q4
Activity 5[Null][Null][Null]10111[Null][Null][Null][Null][Null][Null]Q4
Activity 1[Null][Null][Null][Null][Null][Null]45348[Null][Null][Null]Q4
Activity 2[Null][Null][Null][Null][Null][Null]92736[Null][Null][Null]Q4
Activity 3[Null][Null][Null][Null][Null][Null]53338[Null][Null][Null]Q4
Activity 4[Null][Null][Null][Null][Null][Null]251540[Null][Null][Null]Q4
Activity 1[Null][Null][Null][Null][Null][Null][Null][Null][Null]8816Q4
Activity 2[Null][Null][Null][Null][Null][Null][Null][Null][Null]19423Q4
Activity 3[Null][Null][Null][Null][Null][Null][Null][Null][Null]49251Q4
Activity 4[Null][Null][Null][Null][Null][Null][Null][Null][Null]331245Q4
Activity 5[Null][Null][Null][Null][Null][Null][Null][Null][Null]181230Q4
Activity 6[Null][Null][Null][Null][Null][Null][Null][Null][Null]42529Q4

 

RESULTS:    
If Current Qtr Field = Q2, only show the 3 fields that contain Q2 in the name
     
Activity ClassificationQ2 QTD-Current Qtr AvgQ2 QTD-Prior Qtr-AvgQ2 QTD-Total Avg 
Activity 122628 
Activity 273239 
Activity 38816 
Activity 488997 
Activity 510111 
     
     
If Current Qtr Field = Q4, only show the 3 fields that contain Q4 in the name
     
Activity ClassificationQ4 QTD-Current Qtr AvgQ4 QTD-Prior Qtr-AvgQ4 QTD-Total Avg 
Activity 18816 
Activity 219423 
Activity 349251 
Activity 4331245 
Activity 5181230 
Activity 642529 

 

4 REPLIES 4
grazitti_sapna
17 - Castor

Hi @J-Riedel , try the workflow attached as you provided the current quarter column so I leveraged that for my workflow if you need to calculate the current quarter on the basis of today's date let me know I will update the workflow. It is just one of the ways to solve the problem.

grazitti_sapna_0-1652447820204.png

Thanks!

Sapna Gupta
Matthew
11 - Bolide

this should do the trick.. and then after the dynamic select tool, just filter out the null rows

 

though of course i made the assumption that you are interested in the current quarter of the year, not the quarter that is in the "current quarter" column

 

contains([Name],"Q"+tostring(ceil(DateTimeMonth(DateTimeToday())/3))) or contains([Name],'Activity Classification')

 

Matthew_0-1652448221594.png

 

 

J-Riedel
8 - Asteroid

Thank you Sapna.  This works perfectly since it can be based on the Q# that I am already brining into the workflow.  I appreciate the quick response and help!

grazitti_sapna
17 - Castor

@J-Riedel I am glad that I could help you and thanks for accepting my post as a solution. Much appreciated!

Sapna Gupta
Labels
Top Solution Authors