Today I see a problem in the goodness of the day, and if I'm not mistaken, it should mean, for example, selecting a time period in a report and then finding the SUM of some Measure for that time period. And at the same time, the SUM of the same Measure between the points corresponding to the last year of the two points is calculated.
For example, the currently selected point of time is January 8, 2004, and the end point is March 1, 2004. Not only does the sum of a measure in this time period be required, but it also requires a measure sum for the period from January 8, 2003 to March 1, 2003. That is, the time period is dynamic, depending on the input of the two time periods to determine the year and the previous year of the calculation.
This has a few small knowledge points, so summed up a bit, first look at the results of the following.
There is also the effect of using Date Picker (Note that if you use a Calendar control, then the types of StartDate and EndDate are date/time types)-
Design of non-Date Picker parameters
Check the Cube to verify that the query results are the same.
With member [Measures]. [Reseller Sales Amount of Period]
As
SUM (
[date].[ Calendar]. [Date].&[20040108]:[date]. [Calendar]. [date].&[20040301]
, [measures].[ Reseller Sales Amount]
) member
[measures].[ Reseller Sales Amount of last Period]
as
SUM (
[date].[ Calendar]. [Date].&[20030108]:[date]. [Calendar]. [date].&[20030301]
, [measures].[ Reseller Sales Amount]
)
SELECT NON empty{[measures].[ Reseller Sales Amount of Period],
[measures].[ Reseller Sales Amount of Last Period]} on COLUMNS,
NON EMPTY {([product].[ Category]. [Category]. ALLMEMBERS)} on ROWS from
[step-by-step]