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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

Transforming rows into columns

Hello everyone

I have a table in a qlikview document as follows:

TheValue                                      TableName

-------------------------------------------------------------------------------------------------

x                                                  Colors.PropertyValueID

y                                                  Make.PropertyValueID

z                                                  Machinery.PropertyValueID

...

Now I want to transform the above table into the following structure:

TheValue                Colors.PropertyValueID             Make.PropertyValueID             Machinery.PropertyValueID

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

x                            x                                              NULL                                    NULL

y                            NULL                                        y                                          NULL

z                            NULL                                        NULL                                    z

....

is this possible?

Please advise!!!

I can walk on water when it freezes
5 Replies
swuehl
MVP
MVP

Maybe like

TRANSFORM:

Generic LOAD *, TheValue as Value INLINE [

TheValue       ,   TableName

x,                 Colors.PropertyValueID

y,                 Make.PropertyValueID

z,                 Machinery.PropertyValueID

];

A table box in the front end will show your expected result.

ali_hijazi
Partner - Master II
Partner - Master II
Author

this gives me 3 different tables

I want them all in one table

I can walk on water when it freezes
swuehl
MVP
MVP

INPUT:

LOAD * INLINE [

TheValue       ,   TableName

x,                 Colors.PropertyValueID

y,                 Make.PropertyValueID

z,                 Machinery.PropertyValueID

];

CROSS:

Generic LOAD *, TheValue as Value resident INPUT;

RESULT:

LOAD TheValue resident INPUT;

drop table INPUT;

left join (RESULT) LOAD * resident CROSS.Colors.PropertyValueID;

left join (RESULT) LOAD * resident CROSS.Make.PropertyValueID;

left join (RESULT) LOAD * resident CROSS.Machinery.PropertyValueID;

drop tables CROSS.Colors.PropertyValueID, CROSS.Make.PropertyValueID, CROSS.Machinery.PropertyValueID;

ali_hijazi
Partner - Master II
Partner - Master II
Author

thank you for your support but I have one thing

the number of rows is dynamic and the table Result of mine has more than 9 milliions records

I need a generic way to apply left join on result

since colors.propertyvalueid and the rest are not static

I can walk on water when it freezes
Jason_Michaelides
Partner - Master II
Partner - Master II

See Alex's solution here:

http://community.qlik.com/message/78337#78337

Hope this helps,

Jason