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

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Product tree hierarchy

Hi guys.

I have an issue with product tree hierarchy.

(Important: my customer has QlikView version 8.2, and therefore the hierarchy and hierarchybelongsto cannot be a part of the solution because it is not supported yet in this version)

I have a tree table of products and components, in which some products can be components of other products:

Product Component Date

X 111 ...

X 222 ...

Y 333 ...

Y X ...

Z 444 ...

Z Y ...

Z X ...

Another table is the cost price of the leaves (components that never appear as products):

Component Price

111 1$

222 2$

333 3$

444 4$

Now I have to sum up the cost of the leaves, then the cost of the products.

X = 111+222=3$

Y=X+333=3$+3$=6$

Z=Y+X+444=6$+3$+4$=13$

How can I do it (without using hierarchy fucntion)? As you can see in the example, X must be calculated before Y, and the Y (and X) before Z.

(P.S. I have to add later some operations to each product and pay attention to last cost price date, but I can manage that)

Thanks in advance!!

Montal.

7 Replies
kaushalview
Partner - Creator II
Partner - Creator II

Hi

I have attached one hierarchy example without using hierarchy function.

cahck it.

Regards

Kaushal Mehta

kaushalview
Partner - Creator II
Partner - Creator II

Hi,

Check it below example

Not applicable
Author

Hi Kaushal.

I'm familiar with this example, but it's not helping me because I have a complicated parent-child situation here... Thanks anyway!

Any other suggestions? Is the only option through SQL and not through QV script?

Not applicable
Author

have any one of you created tree hierarchies before QV 9.0?

Not applicable
Author

Montal,

The only way I can see getting the correct results is to add X and Y as components in the price table.

Hope that helps.

Not applicable
Author

Thanks.

The problem is how to know that X should be calculated before Y (and added to the costing table)..?

Not applicable
Author

Here is another way of explaining the solution. You would add X and Y to the component table as shown below.

Product Component Date

X 111 ...

X 222 ...

Y 333 ...

Y X ...

Z 444 ...

Z Y ...

Z X ...

Another table is the cost price of the leaves (components that never appear as products):

Component Price

111 1$

222 2$

333 3$

444 4$

X 111 + 222 = 3$ (this can be a calculation or static value)

Y 333 + X = 6$ (this can be a calculation or static value)

Now when you join the Product table with the Component table the calculation or values will be correct.