9 Replies Latest reply: Jun 19, 2012 10:55 PM by Sebastian Pereira RSS

    aggr with two conditions

      Hi everyone,

              i will be pleased if someone could help me with this expression:

       

      sum(Aggr(if(count(DEAL_EXTERNALS.deal_externals_id) > 1 and USERS.user_created = Mes_AntAnterior,1,0),USERS.email))

       

      up to here:

      sum(Aggr(if(count(DEAL_EXTERNALS.deal_externals_id) > 1 ,1,0),USERS.email)) the values are ok but,

       

      when i add the second condition "and USERS.user_created = Mes_AntAnterior" the values get wrong.

       

      Below the definitions of both:

      Mes_AntAnterior= month(addmonths(today(),-2)) & '-' & year(addmonths(today(),-2))

      USERS.user_created = month(today()) & '-' & year(today())

       

       

      workaround:

      sum(Aggr(if(count(DEAL_EXTERNALS.deal_externals_id) > 1 and USERS.created >= Today()-60,1,0),USERS.email))

      where USERS.created has this kind of format 40493, 40494, 40497.....

       

      i think the problem is with the definitions of Mes_AntAnterior and USERS.user_created. How can i change this definitions to solve the issue.

       

      thanks.

      gerardo