33 Replies Latest reply: Mar 7, 2017 8:58 AM by paolo prinoth RSS

    aggr function for current selection

      We have following Expression


      = Sum(



                        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 ?