Alteryx Designer Desktop Discussions

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

Creating PIVOT in Alteryx

Suhastm08
5 - Atom

Hi All,

 

I am fairly new to Alteryx and trying to create a PIVOT using Alteryx. Please refer to the below sample data, i have the Customer ID, Customer Category and Age Bucket for pending Customer Queries.

 

I want to create a PIVOT table which reflects the queries pending for each customer category under the age bucket. I am not able to upload screenshots or Input files due to data sharing restrictions. The Customer Category and Age Bucket should remain same even if there are no aged queries. For Example, there are no queries under 'Diamond' category, the output should reflect 'Diamond' category with no items under the age buckets.

 

I have tried using the Summarise and Cross Tab tool but unable to achieve the required output. Can you please suggest a solution? 

 

Input Data:

Customer IDCustomer CategoryAge Bucket
B12Gold0
B13Silver1
B14Platinum2
B15Bronze>2
B16Bronze>2
B17Gold2
B18Bronze1
B19Gold2
B20Platinum1
B21Bronze0
B22Bronze0
B23Silver1
B24Silver>2
B25Bronze>2

 

Expected Output PIVOT:

Customer CategoryAge 0Age 1Age 2Age >2
Gold1-2-
Silver-2-1
Platinum-11-
Bronze21-3
Diamond----
7 REPLIES 7
cjaneczko
13 - Pulsar

Try this. Null values can be replaced with a multifield formula if required.

 

image.pngimage.png

grazitti_sapna
17 - Castor

Hi@Suhastm08 

One Way of Doing this. Please Check.

If it works Kindly accept it as Solution.

Thanks

Sapna Gupta
Hammad_Rashid
11 - Bolide

To achieve the desired output in Alteryx, you can use the Cross Tab tool along with some additional configurations. Here are the steps to create the pivot table:

  1. Input Data: Drag and drop an Input Data tool to load your data into Alteryx.

  2. Cross Tab Tool Configuration:

    • Drag and drop a Cross Tab tool.
    • Connect the Input Data tool to the Cross Tab tool.
    • In the Cross Tab tool configuration, set the following fields:
      • Data Field: Customer ID
      • Column Field: Age Bucket
      • Row Field: Customer Category
      • Cell Value Field: Count (or any other summary method you prefer, depending on your needs)
  3. Filter Rows with Zero Count:

    • After the Cross Tab tool, use a Filter tool to filter out rows where the Count is 0. This is to ensure that even if there are no queries for a specific combination of Customer Category and Age Bucket, it will still be included in the output.
  4. Optional: Rename Columns:

    • You may want to use a Select tool to rename the columns if needed. This step is optional.
  5. Output Data: Finally, use an Output Data tool to save or preview your results.

Now, when you run the workflow, you should get the desired pivot table as output.

 

The key is to use the Cross Tab tool with the appropriate configuration and filter out rows with zero counts to include all combinations of Customer Category and Age Bucket in the output.

Pang_Hee_Choy
12 - Quasar

to add field that no in data, we can use Text Input for any require fixed table structure.

 

by create a table of Text input as below, and union into the data. the result will show the diamond and age bucket if not exist in data. 

the pair of customer category and age bucket is not important, it just 2 different list in a table.

 

the count can be either 0 or null. I preferred null as the end result is null instead of zero. 

Screenshot 2024-01-16 150946.pngScreenshot 2024-01-16 150953.png

Suhastm08
5 - Atom

Hi cjaneczko,

 

Thanks for the suggested Solution, but this approach would still not capture 'Diamond' Customer Category as there are no pending queries in the data shared.

 

Thanks,

Suhas

 

Suhastm08
5 - Atom

Hi Sapna Gupta,

 

Thanks for the suggested Solution, but this approach would still not capture 'Diamond' Customer Category as there are no pending queries in the data shared.

 

Thanks,

Suhas

Suhastm08
5 - Atom

Hi Pang_Hee_Choy,

 

Thanks for the solution. This worked as expected and fulfilled the requirement.

 

Regards,

Suhas

Labels