Search code examples
qlikviewqliksense

Converting data in columns to rows - Qlikview Load


I have a table like the below in an excel sheet:

Person Food Drink Snack
A Sandwich Water Crisps
B Wrap Coke Crisps
C Pasta Coke Crisps
D Sandwich Juice Banana
E Burger Coke Crisps

I want to transform it to the below table while loading the data to qlikview

Person Item
A Sandwich
A Water
A Crisps
B Wrap
B Coke
B Crisps
C Pasta
C Coke
C Crisps
D Sandwich
D Juice
D Banana
E Burger
E Coke
E Crisps

Is there a way to achieve this?


Solution

  • A different way would be with a crosstable.

    Data:
    load * inline [
    Person, Food,   Drink,  Snack
    A,  Sandwich,   Water,  Crisps
    B,  Wrap,   Coke,   Crisps
    C,  Pasta,  Coke,   Crisps
    D,  Sandwich,   Juice,  Banana
    E,  Burger, Coke,   Crisps];
    
    NEW_Table:
    crosstable(Name,Item,1)
    load * resident Data;
    
    drop table Data;
    drop field Name;