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

Pivot Variables

Hi,

My dataset has this structure:

Year bank €

2010 a 1000

2010 b 500

2010 c 200

2009 a 1000

2009 b 500

2009 c 200

I want to prepare a report with pivot tables like that

2009 2010 2010-2009

a € €

b € €

c € €

How can I use the variable "year" like a column?

Thank you!

6 Replies
Miguel_Angel_Baeyens

Hello,

Try a generic load:

OriginalData:LOAD Year, bank, "€"FROM File.qvd (qvd); Data:GENERIC LOAD bank, Year, "€"RESIDENT OriginalData; DROP TABLE OriginalData;


Hope that helps.

EDIT: Create a new pivot table. "bank" as dimension and Sum("2010") and Sum("2009") as expressions. You will need to quote years, otherwise it will sum 2010 instead of the values of field "2010".

pljsoftware
Creator III
Creator III

Hi,

how to use variable "year" like a column? Explain, as dimension???

johnw
Champion III
Champion III

If I understand your question, you use "Year" as a column by using a pivot table, and dragging the "Year" dimension to the top of the chart.

However, that won't get you the difference between the two years. A typical approach for that would be set analysis:

Dimension = bank
2009 = sum({<Year={'2009'}>} Amount)
2010 = sum({<Year={'2010'}>} Amount)
2010-2009 = column(2) - column(1)

Not applicable
Author

Hi,

Yes, as dimension

Not applicable
Author

Correct! Thank you for the answer!

Not applicable
Author

Thank you John! all it's ok and you've understood my answer!