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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Transpose columns information

Hi all, I have a table with the following structure

specialitemprice     specialitemquantity     name     price     quantity

23                         7                               abc        34         5

23                         7                               ddd        22         3

23                         7                               eee        77        2

23                         7                               fff           222       8

And I would like to convert it to:

name     price     quantity

abc        34           5

ddd        22           3

eee        77           2

fff           222         8

special_item 23     7


i.e. create "manually" a new row containing specialitem info (name will be hardcoded)

Any hint?

Thanks!

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

Final:

LOAD

name, price, quantity

from source;

Concatenate (Final)

LOAD DISTINCT
  specialitemprice  as name,

  specialitemquantity as quantity

from source;

-Rob

http://mastersummit.com

http://robwunderlich.com

View solution in original post

3 Replies
swuehl
MVP
MVP

Maybe

Table:

LOAD name,

          price,

          quantitiy

FROM YourTable;

LOAD 'special_item' as name,

          specialitemprice as price,

          specialitemquantity as quantity

FROM YourTable where recno() = 1;

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

Final:

LOAD

name, price, quantity

from source;

Concatenate (Final)

LOAD DISTINCT
  specialitemprice  as name,

  specialitemquantity as quantity

from source;

-Rob

http://mastersummit.com

http://robwunderlich.com

MarcoWedel

Hi Frijolita,

one possible solution for your problem could be:

tabPrices:

Load * Inline [

specialitemprice,specialitemquantity,name,price,quantity

23,7,abc,34,5

23,7,ddd,22,3

23,7,eee,77,2

23,7,fff,222,8

];

Concatenate

LOAD Distinct

  'special_item' as name,

  specialitemprice as price,

  specialitemquantity as quantity

Resident tabPrices;

DROP Fields specialitemprice,specialitemquantity;

which turns this table

QlikCommunity_Thread_109648_Pic0.JPG.jpg

into this

QlikCommunity_Thread_109648_Pic1.JPG.jpg

hope this helps

regards

Marco