5 Replies Latest reply: Jan 12, 2016 12:32 PM by Miguel Braga RSS

    Problem with Date and AddDate

    Sebastian Tunnell

      Hi everyone,

       

      I have been having a problem with a formula in set analysis:

       

      sum(aggr(

      if([Payment Type ID] = 1

        ,sum({< [Calendar Year Month ID] =  {'$(=max([Calendar Year Month ID]))'}, [Payment Type ID] = {1}, [Calendar Date]=  {'<$(=date(today(0)-4))'}>}  _f_OK_POSITIVE_TRX)

        ,sum({< [Calendar Year Month ID] =  {'$(=max([Calendar Year Month ID])-1)'},[Payment Type ID] = {2},[Calendar Date]=  {'<$(=date(AddMonths(today(0)-4,-1))'}>}  _f_OK_POSITIVE_TRX)

        )

      ,[Merchant ID], [Payment Type ID],[Calendar Date]))

       

      For some reason this part:

       

      =date(AddMonths(today()-4,-1))

       

      Works in a text box, but when I use it the set analysis it doesn't. Is there anything I'm missing?