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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Cross table issue

Hi guys,

I have a table that looks like

ID     2011     2012     2013

1     10          12          14

1     12          14          20

1     30           20         50

2     3            10          15

2     25           25          3

3     24          21           35

How can I do cross table so I get :

ID     Amount

1          36

1          46

1          100

2          28

2          53

3          80

Thanks in advance for your help!

1 Solution

Accepted Solutions
Anonymous
Not applicable

Shouldn't be a problem - but it is not clear what is the meaning of three rows for ID 1, and two rows for ID 2.  If there is no meaning, the result should be:

1     182

2     81

3     80

Need clarification

Regards,

Michael

Edit:  I just thought that you maybe have a unique row id (?).  If this is the case - see attched.

View solution in original post

4 Replies
Anonymous
Not applicable

Shouldn't be a problem - but it is not clear what is the meaning of three rows for ID 1, and two rows for ID 2.  If there is no meaning, the result should be:

1     182

2     81

3     80

Need clarification

Regards,

Michael

Edit:  I just thought that you maybe have a unique row id (?).  If this is the case - see attched.

alec1982
Specialist II
Specialist II
Author

Thanks man,

I still have one little thing.

How can I keep a year field to show the year

So it will look like:

RawID      ID     Year     Sum(Amount)

Thanks,

Alec,

manojkvrajan
Luminary
Luminary

Please add the Year field to the final script right before the Sum (Amount) and add the Year to the Group By clause.

alec1982
Specialist II
Specialist II
Author

Thanks!