Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

convert rows in to columns (without generic load)

Hi Folks,

i got a question:

my table does look like:

Material Months Value
A 1 5
A 2 10
B 1 2
B 2 4

 

my expected output is:

 

Material 1 2
A 5 10
B 2 4

 

My question is: is that possible to convert rows to columns without using of generic load?

Does anybody have any idea?

Thanks a lot

Labels (1)
10 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I know it's not the question you asked, but I'm curious. Why not generic load?

It's an interesting question regardless of the reason, and seeing as how I'm teaching Advanced Scripting at the upcoming Masters Summits for Qlik in Madrid and New Orleans, where I claim that just about anything can be scripted, I may as well answer this one.

Raw:
LOAD * Inline [
Material, Months, Value
A, 1, 5
A, 2, 10
B, 1, 2
B, 2, 4
]
;


Final:
LOAD Distinct
  Material
Resident Raw;

For i = 1 to FieldValueCount('Months')
  let vName = FieldValue('Months', $(i));
  Join (Final) LOAD Material, Value as [$(vName)]
  Resident Raw
  Where Months = '$(vName)';
Next i
Drop Table Raw; 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com