Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bushpalaamarnat
Creator
Creator

create a relation ship between these two tables

@@Following is sample the price data

  

Material CodeCustomer LocationMax SFT DFCSafety Days SupplyMin SFT DFCW48-17W49-17W50-17W51-17W52-17
AN13101P011162100000
DK15111P0271432270101969186
DK15111P0371432200000
FT11124P02593015122117112107102
FT11124P03593015145140135130125

Following is sample volume data

  

Material CodeCustomer LocationMax SFT DFCSafety Days SupplyMin SFT DFCW48-17W49-17W50-17W51-17W52-17
AN13101P011162100000
DK15111P027143226,8508,6608,1607,5886,969
DK15111P0371432200000
FT11124P025930152,9302,7282,5512,3492,130
FT11124P035930152,1702,0381,9231,7911,649

I need to create a relation ship between these two tables, in qlik by multipling each week price with each week volume. this infomration refreshes every week as it is rolling weeks data.

thank you!

7 Replies
PrashantSangle

Join both table


Before joining rename W48-17 column as W48-17_price in Price table

and W48-17_Volume in volume table

do same for other column also


Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
bushpalaamarnat
Creator
Creator
Author

Thank you for your response Prashant! Sure will defiantly qualify and unqualify the data. How ever, what is the best way to join the tables and write script for each column to do the price*volume? is this some thing you could help. That will simplify my work as this is going to be a weekly task for me to finish am looking for easy and simply script

marcus_sommer

I suggest to transform your data at first per The Crosstable Load‌. After them I would check if this calculation needs to be done really on script-level? If not, I would just concatenate both tables and perform the calculation within the charts.

Instead of the concatenation you could of course do a joining or mapping but both methods will be more expensive especially if there multiple key-values in one of tables or that one or both tables have not all key-values.

- Marcus

bushpalaamarnat
Creator
Creator
Author

thank you! as per your suggestion i concatenated bot the cross tables, but in the out put, could you please help me with why volume number are not populating?

marcus_sommer

Please check if you named the value-field within the crosstable-statement differently and if those values are really not existing within your data.

- Marcus

OmarBenSalem

It would be sthing like this :

Price:

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC", "W48-17" as "W4817 Price", W49-17 as "W49-17 Price", W50-17" as "50-17" Price", W52-17" as "W52-17 Price" from sourcePrice;

join(Price)

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC", "W48-17" as "W4817 Volume", W49-17 as "W49-17 Volume", W50-17" as "50-17" Volume", W52-17" as "W52-17 Volume" from sourceVoume;


final0:

noconcatenate:

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC",

"W4817 Volume"*"W4817 Price" as W4817 ,

"W49-17 Volume"*"W49-17 Price"  as W4917,

"50-17 Volume" * "50-17 Price" as W5017,

"W52-17 Volume" *"W52-17 Price" as W5217

RESIDENT Price;


final:

noconcatenate

crosstable (Week,Volume*Price,5) load *;

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC",

W4817 ,

W49-17,

W50-17,

W52-17


resident final0;



final1:

noconcatenate:

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC",

"W4817 Volume" as "W4817",

"W49-17 Volume" as W4917,

"50-17" Volume" as W5017,

"W52-17 Volume" as W5217


resident Price;

lef join (final)

crosstable (Week,Volume,5) load *;

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC",

W4817 ,

W49-17,

W50-17,

W52-17


resident final1;


final2:

noconcatenate:

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC",

"W4817 Price"as W4817 ,

"W49-17 Price" as W4917,

"50-17" Volume" AS W5017,

"W52-17 Price" AS W5217

resident Price;


lef join (final)

crosstable (Week,Volume,5) load *;

load "Material Code","Custmer Location","Max SFT", "Safety Days Supply", "Min SFT DFC",

W4817 ,

W49-17,

W50-17,

W52-17


resident final2;


drop tables Price, final0, final1, final2;

bushpalaamarnat
Creator
Creator
Author

Thank you for the inputs. i did work the way you said. What if i use qualify over doing it manually the naming convention.