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

Alteryx Designer Desktop Discussions

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

Dynamic CROSSTAB columns with newly added column

wonka1234
10 - Fireball

Hi,

 

I need to add columns to my crosstab dynamically.. I feel like i always have to update it based on my inputs i load.

 

wonka1234_0-1674175070056.png

 

 

I would like to add the newly added columns without having to change them here..  I want to leave "Name" and "value" unchecked.

 

Ie if I load columns 202203, 202204 and so on it should automatially be picked up by the cross tab and not need alteryx.

 

any help would be appreciated.

 

10 REPLIES 10
grazitti_sapna
17 - Castor

Hey @wonka1234 , you will have to create a macro to do so. Please check the below post in which they have modified the XML to change the group by columns in summarize tool. I assume you can use the same approach for cross tab as well.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/dynamically-select-ONLY-group-by-colum...

Sapna Gupta
wonka1234
10 - Fireball

@grazitti_sapna 

 

thanks. Sigh this seems hard.

 

I have a text input, say 202202, 202203 . I am having trouble dynamically taking these inputs to update the xml as each time it will be different.

n8rushton
Alteryx Alumni (Retired)

Would you please be able to share a dataset? I think this is possible with just a dynamic rename and a record

wonka1234
10 - Fireball

@n8rushton 

 

File_NameFile_Date202202202203
Alteryx202202Y 
Alteryx202202Y 
Alteryx202202Y 
Alteryx202202Y 
Power BI202202Y 
Power BI202202Y 
Power BI202202Y 
Power BI202203 Y
Power BI202203 Y
Power BI202203 Y
    

 

so this is a sample input to my crosstab.. but 202203 isnt picked up automatically..

 

wonka1234_0-1674233698855.png

 

n8rushton
Alteryx Alumni (Retired)

do the number of fields change?

wonka1234
10 - Fireball

@n8rushton 

 

Yes. One or more could be added ( ie 202203 and on). In the same regard, it could just be the one field (ie 2022) .

 

Felipe_Ribeir0
16 - Nebula

Hi @wonka1234 

 

Try this

Felipe_Ribeir0_0-1674238021432.png

 

wonka1234
10 - Fireball

@Felipe_Ribeir0  getting a few errors at the macro .

 

Error: mc (175): The Action "Tool #6" has an error: ParseError: unterminated start tag 'Field' at line 2 and column 1
while processing "Action_UpdateRawXml"

 

ErrorLink: mc (175): https://community.alteryx.com/t5/*/*/ta-p/710269?utm_source=designer&utm_medium=resultsgrid|Record #1: Tool #4: The field "202003" is missing. Compare the tool configuration with the input stream.

 

Error: mc (175): The output connection "Output9" was not valid

 

 

my summarize tool looks to be okay:

 

wonka1234_0-1674242448605.png

 

 

and my input to my macro seems to be okay..

 

 

wonka1234_2-1674242496048.png

 

Felipe_Ribeir0
16 - Nebula

@wonka1234  try this version,

 

but you gonna need to adapt to your dataset, try running the macro with the data inside of it.

 

With this filter you can control the columns of the group by.

 

Felipe_Ribeir0_0-1674244119248.png

 

Labels