I am using an SSAS Cube as datasource for crystal reports, which generates the following MDX Query :
SELECT {[Measures].[AMOUNT]} ON COLUMNS, Hierarchize(Subset({[Time].[Year-Months].[Day].Members}, 0, 5000)) DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON ROWS FROM( SELECT {[Time].[Year-Months].[Day].&[2012-12-01T00:00:00]:[Time].[Year-Months].[Day].&[2012-12-31T00:00:00]} ON COLUMNS FROM [MYCUBE])
The two dates (DATE_FROM, DATE_TO) in the WHERE clause can be entered by the user via prompts. So the result of the query is the AMOUNT for each day between the two dates the user entered.
I have the tricky requirement to create a measure [AMOUNT_TEST], that contains always the AMOUNT at the date of DATE_TO, so in this case [2012-12-31T00:00:00].
So the result should look like this
AMOUNT AMOUNT_TEST 2012-12-31 2 2 2012-12-30 1 2 2012-12-29 3 2 2012-12-28 5 2 2012-12-27 3 2
I couldn't find a way how to reference the date in the WHERE clause in my SELECT part. Functions like TAIL oder LASTMEMBER always give me the member independently of the WHERE clause... Is this somehow possible?
Thanks in advance!