Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

aggr function for current selection

We have following Expression

= Sum(

          Aggr(

                  Count(DISTINCT

                  IF(C_Stagione = '$(sSaison1)',

                  if (DT_Ordine >= if (isnull(dVon1) or dVon1 = '', DT_Ordine, dVon1) AND

                                    DT_Ordine <= if (isnull(dBis1) or dBis1 = '', DT_Ordine, dBis1), C_Cliente),

                  IF(C_Stagione = '$(sSaison2)',

                  if( DT_Ordine >= if (isnull(dVon2) or dVon2 = '', DT_Ordine, dVon2)  AND

                                    DT_Ordine <= if (isnull(dBis2) or dBis2 = '', DT_Ordine, dBis2), C_Cliente)))), C_Cliente  ) )

sSaison1, sSaison2, dVon1, dVon2, dBis1, dBis2 are in an INPUTBOX

The (total) result is only correct for current selections.

For example in any case we need to have current selection for C_Stagione (which is the same as sSaison..)

The results work fine with following Expression

count (distinct {$<C_Stagione = {$(#sSaison1),$(#sSaison2)}>}  C_Cliente)

but this expression does not consider further conditions (dVon.., dBis..)

Any idea how to solve ?

33 Replies
sunny_talwar

Wherever the condition within the set analysis isn't met, the expression will default to 0. So, if you have unchecked 'Suppress Zero Values', you should still see 0.

Thank you - it works - but sometimes we get a difference of one

Where are you seeing this? Can you share more details here?

Not applicable
Author

Understood -

sunny_talwar

Is everything resolved? I would suggest you to rightfully mark a response which is correct instead of your own response as a correct response. The reason I ask you this is because it will be helpful for future visitors to see a correct response rather than thanks as correct response when they are looking to resolve similar issue.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny

Not applicable
Author

still a lot to learn - have a nice day