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: 
Anonymous
Not applicable

set analysis help

Hi

Below is my set  script .My requirement is i want to exclude particular department.

I tried with my set script .I am not sure this is correct .please correct if i am wrong.

sum({<Dept-={"NZA"}>}Gross_sales)



I need sum sum of gross sales exluding NZA department.

Thanks

1 Solution

Accepted Solutions
sunny_talwar

May be this:

=Sum({<Dept= E({<Dept = {'NZA'}>})>}Gross_sales)

View solution in original post

6 Replies
PrashantSangle

Hi,

Yes it is correct Syntax.

You can also use e() Indirect set analysis.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
maxgro
MVP
MVP

maybe (try both)

sum({<Dept=-{"NZA"}>} Gross_sales)

Not applicable
Author

Yes, its correct

Sum({<Dept-={'NZA'}>}Gross_sales)

sunny_talwar

May be this:

=Sum({<Dept= E({<Dept = {'NZA'}>})>}Gross_sales)

Anonymous
Not applicable
Author

Thanks All

mohammadkhatimi
Partner - Specialist
Partner - Specialist

Hie...

=Sum({<Dept= E({<Dept = {'NZA'}>})>}Gross_sales)

Hope this will helps u...

You can only use p() and e() function in a set analysis set modifier.

From the 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.

Regards,

Mohammad