Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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