Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Going from a cross table to a straight table

Hi,

I'm pulling data from a database using SQL and currently the data I need is in columns - how do I convert it into rows so I can dod the necessary QlikView analysis on it?

At the moment this is what I have (not sure if it's right or not)-

Let Loopnum = 0;

 

For Loopnum = 1 to 12

 

first 100

LOAD Entity, Currency, $(Loopnum) as Period, "[" & $(Loopnum) & "]" ;

SQL SELECT Entity, Currency, [$(Loopnum)] FROM v_Consol_Model_PEHLG;

Next Loopnum;

The database contains columns 1 through to 13 i.e. period 1 - 12 plus YTD, the columns are labelled like that as well.1, 2, 3... etc.

Example

Entity   Currency     1          2        3

A          Local          100     102     99

A          Reporting    200     201     198

B          Local          150     100     102

B          Reporting    300     200     201

I thought I could take the approach of looping so that I pick up each month at a time.

Can anyone help please?

Thank you in advance

C

0 Replies