Forum Discussion

IF's avatar
IF
Icon for Post Prodigy rankPost Prodigy
4 years ago

Hierarchy and Quantity

Hi,

I have example data here. 

FinalHierarchyQtyName
P111X12
P111X13
P111X14
P121X10
P121X22
P132X24
P142X33
P121X36
P121X37
P132X38
P123X39
P111X40
P111X41
P211X51
P211X14
P221X10
P221X22
P232X24
P242X33
P221X66
P221X67
P211X68
P222X69

 

The data is in order. P1 consists of X12, X,13, X14, X40 and X41, because Hieararchy is 1 and Product is P1. X10 is part of X14, because Hierarchy level is 2 and comes just after X14. X24 is part of X22. X33 is part of X24. X36 is part of X14.

How many of X33 is used  to produce P1? The answer should be 1 x 1 x 2 x 2 =4 by multiplying the values in the column Qty.

I want to make a table that shows the Name, Total_Qty and Product. When I select in the slicer "name" (X33), I want to see in the table; the name (X33), Total_Qty (4) and product (P1) values.

How can I do it?

2 Replies

  • v-xiaosun-msft's avatar
    v-xiaosun-msft
    Icon for Community Support rankCommunity Support

    Hi IF ,

     

    Can you provide a more detailed description of the parent-child relationship definition between individual X's to better solve your problem? Does the 1*1*2*2 result you want is the product of the number of X values associated with X33?

     

    Best Regards,
    Community Support Team _ xiaosun

    • IF's avatar
      IF
      Icon for Post Prodigy rankPost Prodigy

      Sure, the data is in order. There are 23 row and this is the main structure for the hierarchy. I gave to "Final" examples; P1 and P2. P1 consists of X12, X,13, X14, X40 and X41, because the "hieararchy" is 1 for P1.

      X33 has child of X24 since I check the previous column which has "hierarchy" 3.  X24 is the child of the X22 since it has "hierarchy" 2 just before it. Finally x22 is the child of X14. I look for the previous records that has "hierarchy" 1. it is X14.  I basically multiply the Qty values for X14 (which is 1), X22 (which is 1), X24 which is 2, and X33 (which is 2).

      I hope it clarifies more. Provided the full path for parent-child relationship below: