Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Double P() Operator

Hello everyone,

i used with great success the P() operator over time to present information's about ingredients based on a product of a production batch.

Now i need to improve my KPI and present informations about the ingredients of the ingredients.

Basicly i need to go down two levels of analysis.

is this even possible without using the hierarchy function on the script?

thanks and best regards

7 Replies
vishsaggi
Champion III
Champion III

Can you share a sample app and expected output to work on ?

marcus_sommer

In general set analysis and p() within them could be nested. If it's applicable in your case or if other options are more suitable will be depending on your concrete scenario.

- Marcus

Not applicable
Author

Would you mind sharing the correct syntax for a neasted set analysis with p()?

i tried ITEM_NO = P(ITEM_NO = P(INGREDIENT.ITEM_NO))but is not giving the correct output.

the result of this expression just returns the selected item.

marcus_sommer

I think it should be more look like this:

ITEM_NO = P({< INGREDIENT.ITEM_NO = P(INGREDIENT.ITEM_NO)>} ITEM_NO)

whereby it could be more a matter of logic than of the correct syntax if the expression worked or not. It will depend on your datastructures and how which results should be displayed - such nesting could be complicated. Maybe a simpler approach like the following will be work, too:

INGREDIENT.ITEM_NO = P(INGREDIENT.ITEM_NO)

- Marcus

Not applicable
Author

My structure for this scenario is kinda simple:

I have two tables Products and Ingredients that are connected with a perfect key composed of PLANT and Batch Number. For every Product i have all the ingredients, intermediates and bulks used.

In the table Products i also have all the Intermediates and bulks since they are created in a plant with a unique batch number:

What i want to reach with this double P operator is simply see Three levels of depth in the production for a final Product


For Example Product A is composed by IA, IB and IC. -> No Set analysis needed everything is done by selection

IC is also a product and is composed by IIA, IIB and IIC -> First Level P operator i get the IC using ITEM_NO = P(INGREDIENT.ITEM_NO) and everything works fine


IIB is also a product and is composed by IIIA, IIIB, IIIC -> Second level P operator i can't get the desired value and when i try the options you kindly described i get a first level output or a zero level output (selection i made).

Every try i just did is always returning the selected ITEM_NO when used in the expression. Looks like when combining the 2 P() operators is not possibile to search the values correctly.

Not applicable
Author

Example.png

Consider the attached image i guess is more clear to understand than what i wrote

marcus_sommer

I don't know if this could be done in your wanted way - perhaps you need yet use a kind of hierarchy, maybe this is helpful: Bill of Materials.

- Marcus