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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mervin8911
Contributor II
Contributor II

Associating 2 Excel sheets, one with one worksheet and the other multiple

Hi there

I am working on a dashboard and have 2 excel workbooks. One has a summary of products sold but no sales amounts, just quantity. My Sales figures are on a different workbook, but they are on different tabs and summarized by year, size of product and product type. I need to associate 3 tables, my year, brand, pack size and quantity to get my total sales value of each brand. Is there anyone who can assist in me associating the tables to get the information I need. The first table below is the summary of sales for the reporting period.

The tables below that are a summary of what the product cost by brand and size. As you can see its a summary and need to be associated with the data on the fist table to get the overall sales. The table below has more than 17000 rows, this needs to be associated with the tables below which only has 8 rows. 

Fin YearYearMonthBrandPack SizeRegionChannelSales Qty
20162015AugCola Max1 LEastern CapeDistributors652
20162015AugCola Max1 LEastern CapeForecourts567
20162015AugCola Max1 LEastern CapeRestaurant Chains227
20162015AugCola Max1 LEastern CapeSupermarket Chains1389
20162015AugCola Max1 LGautengDistributors794
20162015AugCola Max1 LGautengForecourts680
20162015AugCola Max1 LGautengRestaurant Chains1361

 

Cost of products in 2016

Brand1l2L500ml250ml 
Cola MaxZAR 13.50ZAR 26.00ZAR 8.50ZAR 6.00 
Fizzy PeachZAR 13.50ZAR 26.00ZAR 8.50ZAR 6.00 
Grape SupremeZAR 13.50ZAR 26.00ZAR 8.50ZAR 6.00 
Juicy AppleZAR 13.50ZAR 26.00ZAR 8.50ZAR 6.00 
Pine PopZAR 13.50ZAR 26.00ZAR 8.50ZAR 6.00 
Super MaxZAR 13.50ZAR 26.00ZAR 8.50ZAR 6.00 
Very BerryZAR 13.50ZAR 26.00ZAR 8.50ZAR 6.00 
XtremeOrangeZAR 18.50ZAR 26.00ZAR 13.00ZAR 9.00 
      

 

Cost of product in 2017

Brand1L2L500ml250ml
ColaMaxZAR 15.00ZAR 28.00ZAR 11.00ZAR 8.00
FizzyPeachZAR 15.00ZAR 28.00ZAR 11.00ZAR 8.00
GrapeSupremeZAR 15.00ZAR 28.00ZAR 11.00ZAR 8.00
JuicyAppleZAR 15.00ZAR 28.00ZAR 11.00ZAR 8.00
PinePopZAR 15.00ZAR 28.00ZAR 11.00ZAR 8.00
SuperMaxZAR 15.00ZAR 28.00ZAR 11.00ZAR 8.00
VeryBerryZAR 15.00ZAR 28.00ZAR 11.00ZAR 8.00
XtremeOrangeZAR 22.00ZAR 40.00ZAR 17.00ZAR 11.00
1 Solution

Accepted Solutions
teiswamsler
Partner - Creator III
Partner - Creator III

Hi Mervin

You change your model a little and unpivot your cost table:

Br. Teis

See script below.

Fact:
Load
*,
Brand &'|'& [Pack Size] &'|'& [Fin Year] as CombinedKey
inline [
Fin Year, Year, Month, Brand, Pack Size, Region, Channel, Sales Qty
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Distributors, 652
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Forecourts, 567
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Restaurant Chains, 227
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Supermarket Chains, 1389
2016, 2015, Aug, Cola Max, 1L, Gauteng, Distributors, 794
2016, 2015, Aug, Cola Max, 1L, Gauteng, Forecourts, 680
2016, 2015, Aug, Cola Max, 1L, Gauteng, Restaurant Chains, 1361
];

[tmp_Brand ans size]:
Load
*,
'2016' as Year
inline [
Brand, 1L, 2L, 500ml, 250ml,
Cola Max, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Fizzy Peach, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Grape Supreme, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Juicy Apple, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Pine Pop, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Super Max, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Very Berry, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
XtremeOrange, ZAR 18.50, ZAR 26.00, ZAR 13.00, ZAR 9.00
];

Concatenate([tmp_Brand ans size])
Load
*,
'2017' as Year
Inline [
Brand, 1L, 2L, 500ml, 250ml,
ColaMax, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
FizzyPeach, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
GrapeSupreme, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
JuicyApple, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
PinePop, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
SuperMax, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
VeryBerry, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
XtremeOrange, ZAR 22.00, ZAR 40.00, ZAR 17.00, ZAR 11.00
]
;

[Unpivot_Brand ans size]:
CROSSTABLE ([Pack Size],[Cost],2)
LOAD
Year,
Brand,
[1L],
[2L],
[500ml],
[250ml]
RESIDENT [tmp_Brand ans size];

DROP TABLE [tmp_Brand ans size];

[Brand and size]:
Load
*,
Brand &'|'& [Pack Size] &'|'& [Year] as CombinedKey
Resident [Unpivot_Brand ans size];

Drop field Brand, [Pack Size], [Year] from [Brand and size];

Drop table [Unpivot_Brand ans size];

View solution in original post

2 Replies
teiswamsler
Partner - Creator III
Partner - Creator III

Hi Mervin

You change your model a little and unpivot your cost table:

Br. Teis

See script below.

Fact:
Load
*,
Brand &'|'& [Pack Size] &'|'& [Fin Year] as CombinedKey
inline [
Fin Year, Year, Month, Brand, Pack Size, Region, Channel, Sales Qty
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Distributors, 652
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Forecourts, 567
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Restaurant Chains, 227
2016, 2015, Aug, Cola Max, 1L, Eastern Cape, Supermarket Chains, 1389
2016, 2015, Aug, Cola Max, 1L, Gauteng, Distributors, 794
2016, 2015, Aug, Cola Max, 1L, Gauteng, Forecourts, 680
2016, 2015, Aug, Cola Max, 1L, Gauteng, Restaurant Chains, 1361
];

[tmp_Brand ans size]:
Load
*,
'2016' as Year
inline [
Brand, 1L, 2L, 500ml, 250ml,
Cola Max, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Fizzy Peach, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Grape Supreme, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Juicy Apple, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Pine Pop, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Super Max, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
Very Berry, ZAR 13.50, ZAR 26.00, ZAR 8.50, ZAR 6.00
XtremeOrange, ZAR 18.50, ZAR 26.00, ZAR 13.00, ZAR 9.00
];

Concatenate([tmp_Brand ans size])
Load
*,
'2017' as Year
Inline [
Brand, 1L, 2L, 500ml, 250ml,
ColaMax, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
FizzyPeach, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
GrapeSupreme, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
JuicyApple, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
PinePop, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
SuperMax, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
VeryBerry, ZAR 15.00, ZAR 28.00, ZAR 11.00, ZAR 8.00,
XtremeOrange, ZAR 22.00, ZAR 40.00, ZAR 17.00, ZAR 11.00
]
;

[Unpivot_Brand ans size]:
CROSSTABLE ([Pack Size],[Cost],2)
LOAD
Year,
Brand,
[1L],
[2L],
[500ml],
[250ml]
RESIDENT [tmp_Brand ans size];

DROP TABLE [tmp_Brand ans size];

[Brand and size]:
Load
*,
Brand &'|'& [Pack Size] &'|'& [Year] as CombinedKey
Resident [Unpivot_Brand ans size];

Drop field Brand, [Pack Size], [Year] from [Brand and size];

Drop table [Unpivot_Brand ans size];

mervin8911
Contributor II
Contributor II
Author

Thanks for the solution. Took me a while but finally got it to work.