Hi
My requirement is to calculate previous 7 days data in a crosstab. I run a report having user prompt of date. The dataset contains data of current month + previous month. eg: User Prompt : 14-10-2015 then dataset contains data from 01-09-2015 till 14-10-2015.
What I want to show in my crosstab is Date horizontally , model vertically and in body, I want to calculate retail of previous 7 days.
I used two approaches first using relative date.
if Calender Date =14-10-2015
Relative_Date1=RelativeDate([Calender Date]);-6)= 9-10-2015
Relative_Date2=RelativeDate([Calender Date]);-1)= 13-10-2015
Variable = Sum([Retail]) where ([Calender Date]) between(Relative_Date1);(Relative_Date2))
This variable gives me the sum of the entire month but doesnt give the data of desired range.
Second approach is using Previous function:
Variable=([Retail].[Retail]+Previous([Retail].[Retail];([Model]))+Previous([Retail].[Retail];([Model]);2)
+Previous([Retail].[Retail];([Model]);3)+Previous([Retail].[Retail];([Model]);4)+
Previous([Retail].[Retail];([Model]);5)+Previous([Retail].[Retail];([Model]);6))
In this calculation is correct but problem comes for first six dates because previous function works on values shown in crosstab or table but not in dataset.
Please suggest a way forward.