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

How to pass variables to Pivot Table

Kuha
7 - Meteor

Hi,

 

I am creating a pivot table using this process.

Kuha_0-1680339548080.png

I have to create about 20 pivot tables. Is it possible to pass the info required for the 'Cross Tab' from a text file using micro, So I don't need to create 20 processes?

 

I am new to Alteryx and not familiar with micro. Any suggestions would be a great help. Thanks.

 

Kuha

 

14 REPLIES 14
martinding
13 - Pulsar

Hi @Kuha,

 

Please see below:

martinding_0-1680398755165.png

 

I've set a relative path in the macro, but feel free to change it to your desired saving location in the formula tool.

martinding_1-1680398843902.png

 

Kuha
7 - Meteor

Hi @martinding,

 

Thank you very much for the solution. It works fine with my production data.

 

Kuha

Kuha
7 - Meteor

HI @martinding ,

 

I was experimenting further using your macro to enhance the process, but I am unable to get it right.

 

This is what I did. I added another column (FilePathe) with file details in the hope of saving the pivot data in the same file and sheet.

Report IDFilterColumn HeadersValuesMethod of AggregatingFilePath
Report01RegionRepC_Jan-23SumC:\DbTemp\Alteryx\Pivot_Report_03-Mar-2023.xlsx|||Pivot1$A1:L4
Report02RepItemC_Feb-23SumC:\DbTemp\Alteryx\Pivot_Report_03-Mar-2023.xlsx|||Pivot1$A9:F20
Report03RegionItemTotalSumC:\DbTemp\Alteryx\Pivot_Report_03-Mar-2023.xlsx|||Pivot1$A25:F28
Report04ItemRegionTotalSumC:\DbTemp\Alteryx\Pivot_Report_03-Mar-2023.xlsx|||Pivot1$A32:D37

 

Any idea how to make this work? Or is it even possible?

 

Kuha

martinding
13 - Pulsar

Hi @Kuha,

 

Yes, it is possible to save the data on the same sheet and in the same excel file.

 

There are multiple approaches:

1. Make use of the reporting tools (the approach I took)

2. Saving as ranges (I haven't tried this approach but I think it is less dynamic as it may be difficult to predict what the ranges will be before creating the tables).

 

There might be other approaches as well that I am not aware of, hopefully, other people in the community can help (feel free to post this as another question, I would also be really interested to see other solutions and approaches!)

 

Please see below for the Reporting Tool approach (I've updated the workflow and macro slightly): 

martinding_0-1680557844444.png

 

Kuha
7 - Meteor

Hi @martinding 

 

Thank you very much for your time and effort. It is very useful. I never tried any reporting tools. It is a starting point.

 

I have now managed to create and save the Pivot outputs to the same Excel file. I am just learning macro and your help is greatly appreciated. Thanks a lot.

 

Kuha

Labels
Top Solution Authors