Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paul_scotchford
Specialist
Specialist

Get Last Year values based on user date selection

Hi All
This may have already been answered elsewhere but my searches seem to not pick up a suitable answer and
pleae forgive my newness to QV and Set Analysis.
I want to show Sales This Year (2013) and Last Year (2012)
Now, when the user selects 1 Aug 2013 I want to show on the chart 1 Aug 2013 and 1 Aug 2012 then          (This Works fine )
                         user selects    Aug 2013 I want to show on the chart    Aug 2013 and    Aug 2012 then          (This works too  )
                         user selects            2013 I want to show on the chart           2013 and           2012                  ( Shows All 2013 but persists Aug 2012)
I have tried various combinations of my set analysis but just cant get the correct Aggregation part , the user
sees current year , but the Aug 2012 persists.
Here's a sample of my set analysis ( not original I sourced it from another blog post here )
Many thanks in advance for any feedback.
{$<MonthID = {$(=Max(MonthID) - 12)},
Date = {"<=$(=Date(MakeDate(Max(Year) - 1, Max([Month (#)]), Day(Max(SaleDate))),'YYYY-MM-DD'))"},
Year = {$(=Max(Year)-1)},
Quarter = ,
Period = ,
[Period (#)] = ,
Month = >}
0 Replies