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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Repivot Excel Data in Load Script?

Hiya Guys,

I have MS Excel data in the format:

AccountAccount NameJanuaryFebruaryMarch
1My Account100200350

To make this useable in QV - how do I Script a re-pivot so the data is loaded as:

AccountAccount NameMonthAmount
1My AccountJanuary100
1My AccountFebruary200
1My AccountMarch350

Surely this is fundamentally what QV is used for and this should be straight forward?! - or am I approaching the issue incorrectly?

Cheers,

Steve.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You have two columns you want in front, the months should end up in a field named Month and the amounts in a field named Amount. Use the crosstable function like this:

crosstable(Month,Amount,2)

load * from ...etc

See the load script of the attached qvw


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You have two columns you want in front, the months should end up in a field named Month and the amounts in a field named Amount. Use the crosstable function like this:

crosstable(Month,Amount,2)

load * from ...etc

See the load script of the attached qvw


talk is cheap, supply exceeds demand
MayilVahanan

HI

Use

crosstable in script ..

Please refer this:

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

for example

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Not applicable
Author

It's THAT easy?!  🙂

Thanks guys - it shows what formal training does for you (rather than learning as you go!)  🙂

I'm afraid I have to award the Correct Answer to the first reply.

Cheers,

Steve.

its_anandrjs
Champion III
Champion III

Hi,

Write a script some thing like this in your script

Table:

CrossTable(Months,Value,2)

Load * inline

[

Account, AccountName,          January,   February,     March

1,              My Account,          100,         200,             350

];

HTH

Regards,

Anand