Forum Discussion
Hierarchy and Quantity
Hi,
I have example data here.
| Final | Hierarchy | Qty | Name |
| P1 | 1 | 1 | X12 |
| P1 | 1 | 1 | X13 |
| P1 | 1 | 1 | X14 |
| P1 | 2 | 1 | X10 |
| P1 | 2 | 1 | X22 |
| P1 | 3 | 2 | X24 |
| P1 | 4 | 2 | X33 |
| P1 | 2 | 1 | X36 |
| P1 | 2 | 1 | X37 |
| P1 | 3 | 2 | X38 |
| P1 | 2 | 3 | X39 |
| P1 | 1 | 1 | X40 |
| P1 | 1 | 1 | X41 |
| P2 | 1 | 1 | X51 |
| P2 | 1 | 1 | X14 |
| P2 | 2 | 1 | X10 |
| P2 | 2 | 1 | X22 |
| P2 | 3 | 2 | X24 |
| P2 | 4 | 2 | X33 |
| P2 | 2 | 1 | X66 |
| P2 | 2 | 1 | X67 |
| P2 | 1 | 1 | X68 |
| P2 | 2 | 2 | X69 |
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
Community 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
Post 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: