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: 
Not applicable

Reverse crosstable table

Hi All,

I have 2 table like below

TableA:

Country,Value:

A1,12

A2,23,

A3,34

TableB:

Country,Value:

B1,122

B2,232

B3,342

and I want to create a table like

FinalTable:

KEY,CountryA,CountryB

1,A1,B1

2,A1,B2

3,A1,B3

4,A2,B1

5,A2,B2

6,A2,B3

7,A3,B1

8,A3,B2

9,A3,B3

Whats the easiest way to do that inside the script??

2 Replies
MK_QSL
MVP
MVP

TableA:

Load * Inline

[

Country,Value

A1,12

A2,23,

A3,34

];

NoConcatenate

TableB:

Load * Inline

[

Country,Value

B1,122

B2,232

B3,342

];

Load Distinct Country as CountryA Resident TableA;

Join

Load Distinct Country as CountryB Resident TableB;

Drop Tables TableA, TableB;

Not applicable
Author

TableA:

LOAD * INLINE [

CountryA,ValueA

A1,12

A2,23

A3,34 ];

TableB:

LOAD * INLINE [

CountryB,ValueB

B1,122

B2,232

B3,342 ];

OUTER JOIN (TableA)

LOAD *

RESIDENT TableB;

DROP TABLE TableB;

  FinalTable:

  LOAD

  RowNo() as Key,

  CountryA,

  CountryB

  RESIDENT TableA;

  DROP TABLE TableA;

exit script;