5 Replies Latest reply: Apr 17, 2012 9:03 AM by Lee Alderdice RSS

    Brain Failure!!

      Hello All,

       

      I am having brain failure.  I need to make the below query dynamic and calculate values that fall within the months specified, so:

       

      sum(if(MyDate>='01/04/2010' AND MyDate<'31/05/2011',MyValue)) - returns the correct value for today, hardcoded.

       

      What I need to do is:

       

      Add all my values together that fall within April 2010 to May 2011.  Next month I will need it to be May 2010 - June 2011.  And so on.

       

      I can get the right Months using AddMonths(today(), -24) and AddMonths(today(),-11) respectively for the period that I am working with but my brain is failing on the if statement that says if(MyDate = AddMonths(etc) then sum MyValue.

       

      If I get that working then SetAnalysis would be the next step.  If you can suggest SetAnalysis upfront.  Happy to go that route.

       

      Thanks

       

      Lee