Skip to main content
Announcements
MAINTENANCE ALERT: Dec. 12th starting 9 AM CET. Community will be read-only. GET DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
engishfaque
Specialist III
Specialist III

Sum of quantity based on relations

Dear All,

I'm going to add the quantity of ProductSKU and ChildSKU fields.

For example (real scenario):

relations.xlsx file consist on all the parent and child relations.

In relations.xlsx file, threre is a ChildSKU = "NI-MF-006" with having 7 ParentsSKU, such as illustrated below:

relations.xlsx
parentSKUChildSKU
NI-70701NI-MF-006
NI-70701-ZZNI-MF-006
NI-70701-ZZ1NI-MF-006
NI-70701-ZZ2NI-MF-006
NI-MF-006-ZZ1NI-MF-006
NI-R6501-Gadsden35-MF-006-Set3NI-MF-006
NI-R6501-MF-006-Set2NI-MF-006
NI-MF-00623NI-MF-006

salesYTD2014_testing.xlsx file consist on quantity of each individual items (parent and child) such as illustrated below:

prod_skusum(quantity)
NI-MF-006540
NI-7070113
NI-70701-ZZ20
NI-70701-ZZ158
NI-70701-ZZ210
NI-MF-006-ZZ1141
NI-R6501-Gadsden35-MF-006-Set3227
NI-R6501-MF-006-Set2247
NI-MF-0062382

1. relations.xlsx file consist on relations

2. salesYTD2014_testing.xlsx file consist on quantity


Required Output:Sum of quantity must be sum of all the ParentSKU and ChildSKU in against of NI-MF-006 such as given below.

prod_skusumofquantity
NI-MF-0061338


Kindly find attached files.


Kind regards,

Ishfaque Ahmed

1 Solution

Accepted Solutions
Not applicable

Not sure if this is what you are but maybe:

Relations:

LOAD ParentSKU,

     ChildSKU,

     Ratio

FROM

relationship.xlsx

(ooxml, embedded labels, table is composite);

Concatenate

Load Distinct

  ChildSKU,

  ChildSKU as ParentSKU,

  Ratio

Resident Relations;

LOAD type,

     prod_sku as ParentSKU,

     quantity

FROM

salesYTD2014_testing.xlsx

(ooxml, embedded labels, table is [YTD-2014]);

If you select NI-MF-006 as the ChildSKU it gives the desired result

View solution in original post

10 Replies
engishfaque
Specialist III
Specialist III
Author

Dear All,

Please share script, dimension and expression; I'm using QlikView Personal Edition.

Kind regards,

Ishfaque Ahmed

engishfaque
Specialist III
Specialist III
Author

Dear Experts,

I really need your help, please help me.

If you need any clarification, just tell me.

Kind regards,

Ishfaque Ahmed

jyothish8807
Master II
Master II

Hi Ishfaque,

How did you get out put as:

prod_skusumofquantity
NI-MF-0061338

There are 8 child entries so output should be 8*540 = 4320

Please correct me if I am wrong.

Regards

KC

Best Regards,
KC
Not applicable

Not sure if this is what you are but maybe:

Relations:

LOAD ParentSKU,

     ChildSKU,

     Ratio

FROM

relationship.xlsx

(ooxml, embedded labels, table is composite);

Concatenate

Load Distinct

  ChildSKU,

  ChildSKU as ParentSKU,

  Ratio

Resident Relations;

LOAD type,

     prod_sku as ParentSKU,

     quantity

FROM

salesYTD2014_testing.xlsx

(ooxml, embedded labels, table is [YTD-2014]);

If you select NI-MF-006 as the ChildSKU it gives the desired result

engishfaque
Specialist III
Specialist III
Author

Dear Jyothish,

I'm going to correct you here, actually it is not about multiplication, It's all about addition.

So, please go to "relations.xlsx" file and apply filter in a file,

Search "NI-MF-006", you will find that "NI-MF-006" ParentSKU names exactly given below,

After that, you need to go in "salesYTD2014_testing.xlsx" file,

Where you need to apply filters and then go to column "type" and select "Order" and then go to column "prod_sku" and search individually each name, let's suppose you search "NI-MF-006" it's sum of quantity is "540", same as for "NI-70701", it's sum of quantity is "13" and same as for others to repeat the steps. Here is sum of quantity for each items,

Required output is field "prod_sku" consist on "NI-MF-006" and field "sum of quantity" consist on "1338". It is the sum of all the items including parents and child.

If you need any more clarification please let me know.

Kind regards,

Ishfaque Ahmed

engishfaque
Specialist III
Specialist III
Author

Dear Tyler,

It is not working such as i required, but 3re items quantity is coming right and remaining are missing. Please refer to attached image for more clarification.

img1.png

Kind regards,

Ishfaque Ahmed

jyothish8807
Master II
Master II

Hi Ishfaque,

I guess this is what you are looking for:

script:

LOAD
type,
prod_sku as ParentSKU,
quantity
FROM
[Copy of salesYTD2014_testing.xlsx]
(ooxml, embedded labels, table is [YTD-2014]);


Relations:
LOAD ParentSKU,
     ChildSKU,
     Ratio
FROM
[Copy of relationship.xlsx]
(ooxml, embedded labels, table is composite);

Concatenate

Load Distinct

  ChildSKU,
  ChildSKU as ParentSKU,
Ratio

Resident Relations;

In front end create a straight chart:

in expression:

Sum ({<type={'Order'}>}quantity)

Regards

KC

Best Regards,
KC
Not applicable

Select NI-MF-006 as child SKU, don't select anything on ParentSKU, it will give you the right result

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Relation:

LOAD ParentSKU,

     ChildSKU,

     Ratio,

     D,

     E

FROM

relationship.xlsx

(ooxml, embedded labels, table is composite);

Transaction:

LOAD type,

     prod_sku as ChildSKU,

     quantity

FROM

salesYTD2014_testing.xlsx

(ooxml, embedded labels, table is [YTD-2014]);

Variable: vParentSKU - =Chr(39) & Concat(ParentSKU, Chr(39) &  ',' & Chr(39)) & Chr(39)

In Chart:

Dimension: ChildSKU

Expression: =Sum({<ChildSKU+={$(=vValidChildSKU)}>} quantity)

Regards,

Jagan.