
Re: Gap between "if" and set analysis
Henric Cronström Jun 23, 2014 8:22 AM (in response to Laura Sébille)If your fields (Abonnement_paiement, Abonnement_Offre_nom and [Compteur_abonnement_OK]) are found in different tables in the data model, the two methods can return different results. The Set Analysis will most likely return the result you want.
HIC

Re: Gap between "if" and set analysis
Laura Sébille Jun 23, 2014 8:30 AM (in response to Henric Cronström )Hi Henric
Thanks for your answer.
Yes, one of the fields come from another table.
I will use the set analysis expression then.
But I still don't understand why the result is different ?

Re: Gap between "if" and set analysis
Tresesco B Jun 23, 2014 8:55 AM (in response to Laura Sébille)Set analysis filters the data once for the entire chart you are using, whereas IF filters rowwise. In other words, for your dimension values IF enabled expression would filter based on dimension values, while expression with set analysis would filter for all irrespective of dimension values. Have you considered this fact for your comprehension?

Re: Gap between "if" and set analysis
Henric Cronström Jun 23, 2014 9:15 AM (in response to Laura Sébille)The main difference is that the Sum() is made over different ntuples. In Sum(<Field1>), the summation is made in the table where Field1 is found, but in Sum(<Field1> * <Field2>) the summation is made in a new ntuple  in the Cartesian product between Field1 and Field2  that could have more records that the first table.
In your case, you have three fields inside your Sum(), QlikView will create the Cartesian product between these fields and calculate the sum there.
HIC

Re: Gap between "if" and set analysis
Laura Sébille Jun 23, 2014 9:49 AM (in response to Henric Cronström )I am not sure I get it.
What you explain here is how the set analysis works, right ? It does all the products between tables and then calculate what I want ?
And so, what does a 'if' do ?
Thanks again Henric.

Re: Gap between "if" and set analysis
Henric Cronström Jun 23, 2014 10:17 AM (in response to Laura Sébille)For Sum( {$<Abonnement_paiement={'EMV'}>} [Compteur_abonnement_OK] ) the summation will be made over the rows in the table where [Compteur_abonnement_OK] is found.
For Sum( If( Abonnement_paiement='EMV', [Compteur_abonnement_OK] )) the summation will be made over the rows in the ntuple created by the Cartesian product between the rows of [Abonnement_paiement] and [Compteur_abonnement_OK], i.e. in a table that probably has more records than in the case above.
HIC

Re: Gap between "if" and set analysis
Deborah Pyykkonen Jun 23, 2014 10:49 AM (in response to Henric Cronström )Very helpful post. Thank you Henric.
so when is it good to use If(Sum()) vs Set analysis? I have a client that used no set analysis in their applications since 2008 to date because they did not know about Set Analysis. I am in the process of rebuilding their applications and data model to use Set Analysis rather than ifsums.
I tell me clients that it is faster thus more efficient than use of ifsum. Is this the case?

Re: Gap between "if" and set analysis
Henric Cronström Jun 24, 2014 11:33 AM (in response to Deborah Pyykkonen)Usually Set Analysis is faster  and more importantly  it is faster for large data sets, i.e. when you need the performance.
HIC





