Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Iras
Contributor III
Contributor III

Cross Join the tables and then outer Join

I have a table as below

ReportAreaMapgroceries PVgroceries ACElectric PVElectric ACmail PVmail AC
05_2016DE05_2016_DE454350563043
06_2016ES06_2016_ES675651783123
07_2016FR07_2016_FR787852873233
08_2016BA08_2016_BA899053653343

 

Based on the above table I would like to convert it into table as below: 

MapAttributePVAC

05_2016_DEgroceries 4543
05_2016_DEmail 3043
05_2016_DEElectric 5056
06_2016_ESgroceries 6756
06_2016_ESmail 3123
06_2016_ESElectric 5178
07_2016_FRgroceries 7878
07_2016_FRmail 3233
07_2016_FRElectric 5287
08_2016_BAgroceries 8990
08_2016_BAmail 3343
08_2016_BAElectric 5365

 

note: the result table is not shown completely

To do so I wrote logic as below in Data load editor and I am stuck with no output in the data model viewwe . Could some one please look into my code ? Or if you have any better solution to do the above process it will be great help:

the code is as follows:

List:
LOAD
Report,
Area,
"Map",
"groceries PV",
"groceries AC",
"Electric PV",
"Electric AC",
"mail PV",
"mail AC"
FROM [lib://AttachedFiles/Dummu.xlsx]
(ooxml, embedded labels, table is test);

PV:
load
Map,
sum("groceries PV") as GRS_PV,
sum("Electric PV") as ELE_PV,
sum("mail PV") as MA_PV,
sum("groceries PV") +sum("Electric PV") +sum("mail PV") as Total_PV
Resident List
group by Map;


PVUnpivot:
CROSSTABLE (ID,TypePV,1)
Load
Map,
GRS_PV,
ELE_PV,
MA_PV,
Total_PV
RESIDENT PV;
drop Table PV;

AC:
load
Map,
sum("groceries AC") as GRS_AC,
sum("Electric AC") as ELE_AC,
sum("mail AC") as MA_AC,
sum("groceries AC") +sum("Electric AC") +sum("mail AC") as Total_AC
Resident List
group by Map;


ACUnpivot:
CROSSTABLE (ID,TypeAC,1)
Load
Map,
GRS_AC,
ELE_AC,
MA_AC,
Total_AC
RESIDENT AC;
drop Table AC;


Costs:
load
*
Resident PVUnpivot;
outer Join load * Resident ACUnpivot;
drop table PVUnpivot;
drop table ACUnpivot;

 

Regards and thanks 

Iras

 

 

 

Labels (3)
1 Solution

Accepted Solutions
Iras
Contributor III
Contributor III
Author

 I found the solution.. Thanks alot guys

View solution in original post

1 Reply
Iras
Contributor III
Contributor III
Author

 I found the solution.. Thanks alot guys