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: 
vidyasagar159
Creator II
Creator II

Pivot the Dimension Table

Hello All,

Can you join and pivot a table from the two dimension tables below? If yes what's the best way to achieve it?

I am using QlikSense.

Thanks in Advance and I appreciate all your help.

JoinDimensionTables.PNG

Labels (6)
1 Solution

Accepted Solutions
Ahidhar
Creator III
Creator III

try this

tab1:
load * Inline
[
FruitId,FruitName
1,Apple
2,Banana
3,Orange
];

tab2:
generic load * inline
[
FruitId,Brand,BrandValue
1,MVS,AA
3,SP,A
];


left join(tab1)
load FruitId,MVS
resident tab2.MVS;
left join(tab1)
load FruitId,SP
resident tab2.SP;
drop table tab2.MVS;
drop table tab2.SP;

View solution in original post

3 Replies
Aasir
Creator III
Creator III

// Load data from TableA
TableA:
LOAD
[Fruit ID],
[Fruit Name]
FROM [your data source];

// Load data from TableB
TableB:
LOAD
[Fruit ID],
Brand,
[Brand Value]
FROM [your data source];

// Pivot the TableB to create additional fields based on Brand values
PivotTableB:
LOAD
[Fruit ID],
[Fruit Name],
[Apple] AS BrandValue_Apple,
[Banana] AS BrandValue_Banana,
[Orange] AS BrandValue_Orange
RESIDENT TableA
LEFT JOIN
LOAD * RESIDENT TableB;

// Drop unnecessary fields
DROP TABLE TableA;
DROP TABLE TableB;

Ahidhar
Creator III
Creator III

try this

tab1:
load * Inline
[
FruitId,FruitName
1,Apple
2,Banana
3,Orange
];

tab2:
generic load * inline
[
FruitId,Brand,BrandValue
1,MVS,AA
3,SP,A
];


left join(tab1)
load FruitId,MVS
resident tab2.MVS;
left join(tab1)
load FruitId,SP
resident tab2.SP;
drop table tab2.MVS;
drop table tab2.SP;

vidyasagar159
Creator II
Creator II
Author

Thank you so much, guys. This is what I am looking for.