7 Replies Latest reply: Dec 8, 2011 9:53 PM by Steven Blower RSS

    How to subtract previous week's sale from this week's sale?



      I have straight table displaying weekly sales starting from January 1, 2008 to date. Now the problem is that my QV app displays it like this



      Week          Sales

      201148          133 739

      201147          128 880

      201146          116 031


      ...... and so on.


      This is wrong!

      What I should see instead is, for week 48, it should be ValueOf(201148) - ValueOf(201147) i.e. 4859. So the table should look like this:


      Week          Sales

      201148          4859

      201147          12849

      201146          8690


      ...... and so on.


      What I have in the expression(expression in chart properties->expression tab, not in script) is Sum([Total Sales])

      My questions is, if it is possible to retain the last value of Sum([Total Sales])? Because then I will have the actual value what should be there.

      Something like this=>


      Sum([Total Sales]) - Previous(Sum([Total Sales]))


      Once again, I need to write expression for this in the Expression tab under chart properties for the straight table I am using and Previous function doesn't work here (it only works in the script). Tell me if it's doable or not. I will not answer questions "Why not change in your script?".