Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Re: Repivot Excel Data in Load Script?

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
5 Replies

Re: Repivot Excel Data in Load Script?

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

Re: Repivot Excel Data in Load Script?

HI

Use

crosstable in script ..

Please refer this:

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

for example

Hope it helps

Not applicable

Re: Repivot Excel Data in Load Script?

Not applicable

Re: Repivot Excel Data in Load Script?

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.

Re: Repivot Excel Data in Load Script?

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

Community Browser