Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
newqlik2017
Creator II
Creator II

Display table header with actual values

Hi, I have two input tables, Table1 and Table2 and I can link them based on common KEY. 

Table1

KEY
STATEID
LAYERID

 

Table2

KEY
PERIOD
VALUE1
VALUE2
VALUE3

 

Table1 fields with data:

STATEID LAYERID
STATE1 CA
STATE2 TX
STATE3 FL

 

Table 2 fields with data:

PERIOD VALUE1 VALUE2 VALUE3
10011 101 201 301
10012 102 202 302
10013 103 203 303

 

How can we achieve final Output as below where the column header is the actual values from LayerID field instead of StateID values, which is dynamic and not hard coded ? 

Appreciated any ideas....

Desired output

PERIOD CA TX FL
10011 101 201 301
10012 102 202 302
10013 103 203 303

 

Current output

PERIOD STATE1 STATE2 STATE3
10011 101 201 301
10012 102 202 302
10013 103 203 303
Labels (5)
1 Solution

Accepted Solutions
newqlik2017
Creator II
Creator II
Author

I was able to get the desired output using agg() function 

 

View solution in original post

2 Replies
newqlik2017
Creator II
Creator II
Author

I was able to get the desired output using agg() function 

 

KGalloway
Creator II
Creator II

Could you include a sample of load script like this one?

table1:
load * inline [
KEY, STATEID, LAYERID
1, STATE1, CA
2, STATE2, TX
3, STATE3, FL
]
;


table2:
load * inline [
KEY, PERIOD, VALUE1, VALUE2, VALUE3
1, 10011, 101, 201, 301
2, 10012, 102, 202, 302
3, 10013, 103, 203, 303
]
;

 

I used this to try to test solutions, but it doesn't produce a chart like your current output, so I don't think I did it correctly. What are the KEY values in the two tables? How do they join the data?