6 Replies Latest reply: Dec 21, 2016 11:56 AM by Shubham Singh RSS

    sum field values across a given date range

    fabio martignago

      hello,

       

      so.. I'm tryng to sum a quantity field across a given date range

       

      I have two variable:

      vFromDate

      vToDate

       

      vFromDate is a makedate(2016,1,1) function.

      vToDate is a today() function.

       

      next I have a measure QUANT_AC that is something like this expression (that doesn't work!):

       

      Sum({<DATA={'>$(=vFromDate)<$(=vToDate)'}>}QUANTI)

       

       

      DATA is a date field from:

      LOAD

        Date (Right([DAT_DOC],2) & '/' & Right(Left([DAT_DOC],6),2) & '/' & Left([DAT_DOC],4)) AS DATA

       

      and QUANTI is the article amount.

       

      But I get a great 0 !

       

      PS: before that, I had this expression for the QUANT_AC measure:

       

      SUM(If(ANNO_VENDITA=YEAR(TODAY()),QUANTI))

       

      and it worked, but within the entire year.

       

      what do you think?

       

      thx