I have a problem when I write scopes statement to calculate Calendar Year-To-Date Values in cube using SSAS.
Here is my Date Dimension and its hierarchy:
In measures group, I have a measure named [Sales Amount] which is the sales amount of each item in date. I want to calculate year-to-date value. Here is my scope statement but it don't work well.
SCOPE(MEASURES.[YTD Sales]);
--Calendar YTD
SCOPE([DimDates].[Year-Qtr-Month-Day].MEMBERS, [DimDates].[Year].[Year].MEMBERS);
THIS = AGGREGATE(
PERIODSTODATE([Date].[Year].[Year], [Date].[Year].CURRENTMEMBER),
[Measures].[Sales Amount]);
END SCOPE;
END SCOPE;