Hello all,
I'm trying to calculate the previous year sales by store from my data that contains multiple stores over multiple dates.
My raw data is a follows:
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Store_code
[/TD]
[TD]Trade_Year_Week
[/TD]
[TD]retail_value
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]201201
[/TD]
[TD]10.00
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]201201
[/TD]
[TD]15.00
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]201201
[/TD]
[TD]20.00
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]201202
[/TD]
[TD]7.00
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]201202
[/TD]
[TD]9.00
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]201202
[/TD]
[TD]13.00
[/TD]
[/TR]
</TBODY>[/TABLE]
I also have a date table to convert the Trade_Year_Week into dates.
I have created the following measure:
StoreSalesPrevYr:=CALCULATE(Sales_Data[retail_value], DATEADD(Dates[Date], -1, YEAR))
but there is an error stating in the crrent context retail_value can't be calculated.
I assume this is because I have multiple stores for each Trade_Year_Week, so how do I calculte this measure for each store?
Any help would be greatly appreciated.
Thanks
I'm trying to calculate the previous year sales by store from my data that contains multiple stores over multiple dates.
My raw data is a follows:
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Store_code
[/TD]
[TD]Trade_Year_Week
[/TD]
[TD]retail_value
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]201201
[/TD]
[TD]10.00
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]201201
[/TD]
[TD]15.00
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]201201
[/TD]
[TD]20.00
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]201202
[/TD]
[TD]7.00
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]201202
[/TD]
[TD]9.00
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]201202
[/TD]
[TD]13.00
[/TD]
[/TR]
</TBODY>[/TABLE]
I also have a date table to convert the Trade_Year_Week into dates.
I have created the following measure:
StoreSalesPrevYr:=CALCULATE(Sales_Data[retail_value], DATEADD(Dates[Date], -1, YEAR))
but there is an error stating in the crrent context retail_value can't be calculated.
I assume this is because I have multiple stores for each Trade_Year_Week, so how do I calculte this measure for each store?
Any help would be greatly appreciated.
Thanks