Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join “Do More With Qlik” with Mike Tarallo to get a first-hand look at the New Authoring Experience, June 29th: REGISTER HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikie1
Contributor II
Contributor II

Set Analysis

Hello everybody,

 

I have set analysis within a chart that has below syntax:

count(distinct {
<Primary_Product_Flag={1},

Target_Product=,Sales={"=sum(Sales)>0"},

Product_Code={"=sum({<Product_Group={'PS0016'},Key_IOL_Name >}Sales)>0"}
>
}
Product_Code)

Could you please help me to understand  what Key_IOL_Name  do at this point?

1 Solution

Accepted Solutions
francisco_orte
Partner
Partner

Hi @qlikie1 

A field without any set afterwards, prevents expression to be affected on selections on that field. In other words that sum is not affected on selections made by users in Key_IOL_Name.

You can also write Key_IOL_Name= (with an equal symbol at the end) with same behavior

 

Hope it helps

 

Regards

 

View solution in original post

13 Replies
francisco_orte
Partner
Partner

Hi @qlikie1 

A field without any set afterwards, prevents expression to be affected on selections on that field. In other words that sum is not affected on selections made by users in Key_IOL_Name.

You can also write Key_IOL_Name= (with an equal symbol at the end) with same behavior

 

Hope it helps

 

Regards

 

qlikie1
Contributor II
Contributor II
Author

Hi @francisco_orte,

Thanks for your response. Could you please help me to understand the formula:
it filters Primary_Product_Flag = 1, ignores Target_Product filter,  took Sales>0 for each Product_Code and
took all the Product Codes taht has Sales >0 for Product_Group={'PS0016'} ignoring  Key_IOL_Name  filter?

francisco_orte
Partner
Partner

Hi @qlikie1 

 

I think a good aproach that may  help you to understand is seeing set analysis as a selection for each set modifier.

In your example

Filters Primary_Product_Flag with 1, so forget rest of data (be carefull, alse null values!!!)

Avoid any Target_Product filtering made by user.

Filters on Sales!!!! (not on Product_Code), taking Sales >0. It seems is not intended calculation, you can simplify by Sales ={">0"}

Filters Product_Code (now it is its moment 😉 ), taking those products with Sales > 0 for Product_Group PS0016 whatever Key_IOL_Name is selected

 

And remember, al Set expressions are evaluated out of any object context

Hope it helps

Regards

 

qlikie1
Contributor II
Contributor II
Author

Thanks @francisco_orte . Could you please be more specific about: And remember, al Set expressions are evaluated out of any object context.

Does this mean that no matter how many other modifiers you have, what is in set expression goes first priority omitting other conditions?

francisco_orte
Partner
Partner

Hi @qlikie1 

It means that it works as when you do same selections on your dashboard. You can have a "base Expression" with no set analysis, and you can get same result just making same selections as expressed on your formula.

Regards

NageshSG
Partner
Partner

Hi,

In addition to above points just noticed following in the set expr on  below part..

Product_Code={"=sum({<Product_Group={'PS0016'},Key_IOL_Name >}Sales)>0"}

Are you missing the "P" element above?  Not sure if the following is the expected condition:

Product_Code=P{1<Product_Group={'PS0016'},Sales={'>0'}>} Key_IOL_Name >}

Regards.

francisco_orte
Partner
Partner

HI @NageshSG 

both expressions are different. On the original one (no p function) you take all products with TOTAL sum  sales positive, on the other side (with P) you get all products with at least one positive Sale.

In some scenarios results could be very different. Also be aware on 1 , cause you are missing all user selections.

 

Regards

NageshSG
Partner
Partner

Hi @francisco_orte 

Thanks for highlighting the differences.

Please correct me if my understanding is incorrect:

1. Using identifier 1 inside a P() element, should work like a 'sub query'. In the example above, the question answered is: 

1.1 Get me the list of customers (Key_IOL_Name) who bought items having Product_Group = PS0016 (irrespective of other user selection statuses, since 1 identifier is used). Once this is evaluated then...

1.2  The element function P( ) here returns a list of possible Key_IOL_Name;
those that are implied by the selection ‘PS0016’ in the field Product_Group.
The list of Key_IOL_Name is then used as a selection in the field Product_Code.

1.2 The value returned for Product_Code above is therefore those codes which are bought by Key_IOL_Names. The outer $ identifier still remains and therefore the user selection is still respected for outer conditions.

Regards.

qlikie1
Contributor II
Contributor II
Author

Hi @francisco_orte , Thanks for your response,

and one more thing,  even though we have Target_Product= in formula, the selections on target product work anyway, unless I remove  this part -- Product_Code={"=sum({<Product_Group={'PS0016'},Key_IOL_Name >}Sales)>0"  from the formula. Is it supposed to work like that?