Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Sai33
Partner - Creator
Partner - Creator

Cross Table based on Column Name

Hello All,

I'm looking to convert my Table based on Cross Table logic but the new Column Generated should be based on the Column Name of existing Columns

Sample Data:

DateOrdersADeliveredAOrdersBDeliveredB
01.01.20201051510
02.01.20202010138

 

Expected Result:

DateOrdersDeliveredLocation
01.01.2020105A
01.01.20201510B
02.01.20202010A
02.01.2020138B

 

Thanks 

Sai

 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

You could do something like this.

source:
load * INLINE [
Date, OrdersA, DeliveredA, OrdersB, DeliveredB
01.01.2020, 10, 5, 15, 10
02.01.2020, 20, 10, 13, 8
];

FOR each _location in 'A' , 'B'
  LOAD
    Date,
    Orders$(_location) as Orders,
    Delivered$(_location) as Delivered,
    '$(_location)' as Location
  Resident
    source;
next _location

Drop table source;

View solution in original post

1 Reply
Vegar
MVP
MVP

You could do something like this.

source:
load * INLINE [
Date, OrdersA, DeliveredA, OrdersB, DeliveredB
01.01.2020, 10, 5, 15, 10
02.01.2020, 20, 10, 13, 8
];

FOR each _location in 'A' , 'B'
  LOAD
    Date,
    Orders$(_location) as Orders,
    Delivered$(_location) as Delivered,
    '$(_location)' as Location
  Resident
    source;
next _location

Drop table source;