Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
d_koti24
Creator II
Creator II

Regarding p() and e()

Hi all,

What are the possible values and exclude values?can anyone explain with sample examples

regards,

kd

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi Koti,

From Qlikview help file:

Set Modifiers with Implicit Field Value Definitions

In the above examples, all field values have been explicitly defined or defined through searches. There is however an additional way to define a set of field values by the use of a nested set definition.

In such cases, the element functions P() and E() must be used, representing the element set of possible values and the excluded values of a field, respectively. Inside the brackets, it is possible to specify one set expression and one field, e.g. P({1} Customer). These functions cannot be used in other expressions:

Examples:

sum( {$<Customer = P({1<Product={‘Shoe’}>} Customer)>} Sales )
returns the sales for current selection, but only those customers that ever have bought the product ‘Shoe’. The element function P( ) here returns a list of possible customers; those that are implied by the selection ‘Shoe’ in the field Product.

sum( {$<Customer = P({1<Product={‘Shoe’}>})>} Sales )
same as above. If the field in the element function is omitted, the function will return the possible values of the field specified in the outer assignment.

sum( {$<Customer = P({1<Product={‘Shoe’}>} Supplier)>} Sales )
returns the sales for current selection, but only those customers that ever have supplied the product ‘Shoe’. The element function P( ) here returns a list of possible suppliers; those that are implied by the selection ‘Shoe’ in the field Product. The list of suppliers is then used as a selection in the field Customer.

sum( {$<Customer = E({1<Product={‘Shoe’}>})>} Sales )
returns the sales for current selection, but only those customers that never bought the product ‘Shoe’. The element function E( ) here returns the list of excluded customers; those that are excluded by the selection ‘Shoe’ in the field Product. 

P() or E() to is used to include/exclude the possible values of a field in set analysis expression.  Suppose

sum( {$<Customer = P({1<Product={‘Shoe’}>} Supplier)>} Sales )   - -This returns the sales of Customers who bought shoes.


sum( {$<Customer = E({1<Product={‘Shoe’}>} Supplier)>} Sales )   - -This returns the sales of Customers who do not bought shoes.


Hope this helps you.


Regards,

Jagan.



View solution in original post

3 Replies
Gysbert_Wassenaar

Read this blog post for understanding possible and excluded values: Colors, States and State vectors


talk is cheap, supply exceeds demand
qlikviewwizard
Master II
Master II

Hi,

Please check these threads as well. Thank you.

P() &amp; E()

A Primer on Set Analysis

jagan
Luminary Alumni
Luminary Alumni

Hi Koti,

From Qlikview help file:

Set Modifiers with Implicit Field Value Definitions

In the above examples, all field values have been explicitly defined or defined through searches. There is however an additional way to define a set of field values by the use of a nested set definition.

In such cases, the element functions P() and E() must be used, representing the element set of possible values and the excluded values of a field, respectively. Inside the brackets, it is possible to specify one set expression and one field, e.g. P({1} Customer). These functions cannot be used in other expressions:

Examples:

sum( {$<Customer = P({1<Product={‘Shoe’}>} Customer)>} Sales )
returns the sales for current selection, but only those customers that ever have bought the product ‘Shoe’. The element function P( ) here returns a list of possible customers; those that are implied by the selection ‘Shoe’ in the field Product.

sum( {$<Customer = P({1<Product={‘Shoe’}>})>} Sales )
same as above. If the field in the element function is omitted, the function will return the possible values of the field specified in the outer assignment.

sum( {$<Customer = P({1<Product={‘Shoe’}>} Supplier)>} Sales )
returns the sales for current selection, but only those customers that ever have supplied the product ‘Shoe’. The element function P( ) here returns a list of possible suppliers; those that are implied by the selection ‘Shoe’ in the field Product. The list of suppliers is then used as a selection in the field Customer.

sum( {$<Customer = E({1<Product={‘Shoe’}>})>} Sales )
returns the sales for current selection, but only those customers that never bought the product ‘Shoe’. The element function E( ) here returns the list of excluded customers; those that are excluded by the selection ‘Shoe’ in the field Product. 

P() or E() to is used to include/exclude the possible values of a field in set analysis expression.  Suppose

sum( {$<Customer = P({1<Product={‘Shoe’}>} Supplier)>} Sales )   - -This returns the sales of Customers who bought shoes.


sum( {$<Customer = E({1<Product={‘Shoe’}>} Supplier)>} Sales )   - -This returns the sales of Customers who do not bought shoes.


Hope this helps you.


Regards,

Jagan.