Hello all,
I need some help please in applying a filter to a date table so in my pivot chart I only displays the selected date range.
I have a measure to calculate rolling 12 month sales:
Rolling:=CALCULATE([TY Sales],ALL('TW'),FILTER(ALL('TW'),'TW'[to_date]>=MAX('TW'[to_date])-357&&'TW'[to_date]<=max('TW'[to_date])))
This works fine and calculates my rolling 12 month sales for each week correctly (as my sales data in actually in weeks).
I have joined my 'TW' (tradeweek) table to another tradeweek table that only contains the last 52 weeks that I want to display and this shows me the correct data in the chart. I want to show a rolling 52 weeks on the chart. I can use the YEAR column in my TW table but this will only show the weeks in this year (35 so far for FY14) or 87 weeks if I include FY13 as well.
What I want to do is filter this second TW table dynamically (maybe via a disconnected table) so:
1) it will always have the latest dates in the table (when refreshed from SQL), and
2) the user can select the latest 52 weeks or 104 weeks etc.
I understand how to use FILTER in a CALCULATE expression as per the formul above but how do I use it to filter the dates to display?
Any help would be greatly appreciated.
Thanks
Mark
I need some help please in applying a filter to a date table so in my pivot chart I only displays the selected date range.
I have a measure to calculate rolling 12 month sales:
Rolling:=CALCULATE([TY Sales],ALL('TW'),FILTER(ALL('TW'),'TW'[to_date]>=MAX('TW'[to_date])-357&&'TW'[to_date]<=max('TW'[to_date])))
This works fine and calculates my rolling 12 month sales for each week correctly (as my sales data in actually in weeks).
I have joined my 'TW' (tradeweek) table to another tradeweek table that only contains the last 52 weeks that I want to display and this shows me the correct data in the chart. I want to show a rolling 52 weeks on the chart. I can use the YEAR column in my TW table but this will only show the weeks in this year (35 so far for FY14) or 87 weeks if I include FY13 as well.
What I want to do is filter this second TW table dynamically (maybe via a disconnected table) so:
1) it will always have the latest dates in the table (when refreshed from SQL), and
2) the user can select the latest 52 weeks or 104 weeks etc.
I understand how to use FILTER in a CALCULATE expression as per the formul above but how do I use it to filter the dates to display?
Any help would be greatly appreciated.
Thanks
Mark