Pivot tables with 2 attributes for columns

User: "ivangeraskin"
New Altair Community Member
Updated by Jocelyn

I have table of purchases. Buyers with related Card_IDs buy diffrent products with related Segment (Cheap, Expensive) and Type (Meat, Bread, Milk)
Card_ID - Segment - Type - Amount
1012      - Cheap     - Meat - 1

1012      - Cheap     - Bread - 2

1013     - Expensive - Milk - 1

1013     - Cheap    - Bread - 3

1014     - Expensive - Bread - 1

1014     - Cheap    - Meat - 2

1014     - Expensive - Milk - 1

I want to make a pivot table, where "Card_ID" will be in string, "Segment"+"Type" in columns, aggregation sum by "Amount":
Card_ID - Cheap+Meat - Cheap+Bread - Cheap+Milk - Expensive+Meat - Expensive+Bread - Expensive+Milk

1012      -           1           -           2          -          0          -             0             -             0                -              0           

1013      -           0           -           3          -          0          -             0             -             0                -              1           

1014      -           2           -           0          -          0          -             0             -             1                -              1

Thank you for your help,
Ivan         

Find more posts tagged with