Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
mlarruda
Creator II
Creator II

How can I turn the values of a column into header of other columns?

I have one table like this:

YearNameValue
2016Adam1
2017Adam2
2018Adam3
2016Ben4
2017Ben5
2018Ben6
2016Carl7
2017Carl8
2018Carl9

And I want to turn it into a table like this:

Name201620172018
Adam123
Ben456
Carl789

How can I do it?

Many thanks in advance.

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Why don't you simply use a pivot table. Like

add

Dimensions: Name, Year

Expr: Sum(Value)

Then drag your Year field to top of Expr.

View solution in original post

7 Replies
vishsaggi
Champion III
Champion III

use generic load like below

GenericTab:
Generic Load Name, Year, Value
FROM
[https://community.qlik.com/thread/297410]
(
html, codepage is 1252, embedded labels, table is @1);

mlarruda
Creator II
Creator II
Author

Does it works, being Value the result of an expression, rather than a "pure" variable?

vishsaggi
Champion III
Champion III

Why don't you simply use a pivot table. Like

add

Dimensions: Name, Year

Expr: Sum(Value)

Then drag your Year field to top of Expr.

mlarruda
Creator II
Creator II
Author

Sorry for my ignorance, but how I build/define a pivot table?

mlarruda
Creator II
Creator II
Author

Done! Thanks!

vishsaggi
Champion III
Champion III

Load your data as is. Like

LOAD Year, Name, Value

From yourtablename;

Then right click on sheet properties and select Chart.

Then use Pivot table like below

Then in the dimensions tab you can see your fields

Then add Name and Year to your dimensions and in the expression tab

Add your expression like Sum(Value).

After that you have to drag your Year field to the top of expression.

When you drag you can see a blue arrow like in the above screen shot. Just drag and drop on top of Exper Sum(Value)

vishsaggi
Champion III
Champion III

Awesome. Cool.