3 Replies Latest reply: Aug 15, 2012 11:07 AM by Stefan Wühl RSS

    Calculating current week - x weeks ago on time x-axis

    Brian Booden

      I'm trying to create a line chart that shows Sales this week - Sales 4 weeks ago as a single expression on x-axis of time (week).  Plotting the Sales for the week on the x-axis is simple, that's just




      But i am having trouble with creating the expression that brings in the Sales from 4 weeks ago.  I am trying to use set analysis.  I would expect this to be something like, but this expression does not work:


      Sum(Sales) - Sum ({$<WkNo={$(vWeekNo4WeeksAgo)}>}[Value (£)])


      The variable vWeekNo4WeeksAgo is set up to get the week from 4 weeks ago as per below:


      vWeekNo4WeeksAgo = (Num(WkNo) - 4)


      I am wondering whether this is something i can do with set analysis when mapping against a time axis?  Or do i need to do this sort of thing in the load script to do a mapping to the sales values as they were 4 weeks ago?