Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
praveenman54
Contributor
Contributor

Transpose temp table rows to columns in qlikview script

Hi Experts,

I am really new to Qlikview and trying to work out how I can transpose rows into columns.

My data looks like this

Empname Organisation flag
ABC Sumo 1
ABC Tata 2
XYZ Sofeti 1
XYZ Tata 2

And I want my result to look like

Empname Organisation1 Organisation2
ABC Sumo Tata
XYZ Sofeti Tata

I am not concerned about the flag column. This data is already in qlikview which is in a temptable. So I cannot use cross load. Please, any help is much appreciate.
Labels (1)
1 Solution

Accepted Solutions
techvarun
Specialist II
Specialist II

123:
LOAD * INLINE [
    Empname, Organisation, flag
    ABC, Sumo, 1
    ABC, Tata, 2
    XYZ, Sofeti, 1
    XYZ, Tata, 2
];


124:
Load Empname,Organisation as Organisation1  Resident 123 where flag=1;

125:
Load Empname,Organisation as Organisation2 Resident 123 where flag=2;

126:
Load Distinct Empname Resident 123;

Left Join(126)
Load * Resident 124;


Left Join(126)
Load * Resident 125;

Drop Table 123,124,125;

Try the above code

View solution in original post

4 Replies
olivierrobin
Specialist III
Specialist III

hello,

if the data is already in qv, can't use binary ?

in that case, you load the data in a new .qvw, in which you could use cross load

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

I suggest using Pivot or Straight tables.
Add Dimension Empname.
Add Expression Concat(Organization, ', ').
techvarun
Specialist II
Specialist II

123:
LOAD * INLINE [
    Empname, Organisation, flag
    ABC, Sumo, 1
    ABC, Tata, 2
    XYZ, Sofeti, 1
    XYZ, Tata, 2
];


124:
Load Empname,Organisation as Organisation1  Resident 123 where flag=1;

125:
Load Empname,Organisation as Organisation2 Resident 123 where flag=2;

126:
Load Distinct Empname Resident 123;

Left Join(126)
Load * Resident 124;


Left Join(126)
Load * Resident 125;

Drop Table 123,124,125;

Try the above code

praveenman54
Contributor
Contributor
Author

Thanks Varun. It worked for me.