Background: I am preparng a dataset for a report. To simplify lets say it is two measures, one Category and a time dimension. The main Report Parameter is todays date. I would like to see the first Measure from yesterday (Value 000) and the second measures from the day before yesterday (Value 001). Because previous days data is not available yet for Value 001.
Lets assume 2020-04-27 is today (passed on from the Reporting Tool SSRS).
AS-IS
SELECT {[Measures].[Value 000], [Measures].[Value 001]} ON COLUMNS
, ( {[DIM Category].[Category].&[1], [DIM Category].[Category].&[2]},
[DIM Date].[Y-M-D ISO].[Date].[2020-04-27].LAG(2): [DIM Date].[Y-M-D ISO].[Date].[2020-04-27].LAG(1)
)
ON ROWS
FROM [My_Cube]
Output:
[Value 000] [Value 001]
Category 1 2020-04-25 88 16
Category 1 2020-04-26 89 (null)
Category 2 2020-04-25 90 14
Category 2 2020-04-26 92 (null)
I tried two MDX-Queries for each date and combined the Sets in the Reporting tool but I am wondering if there is a comfortable way to do that in one MDX query. The following would be the desired output.
To-Be
Output:
[Value 000] [Value 001]
Category 1 89 16 (Value from day before, for Value 0001)
Category 2 92 14
The Date doesn't need to be shown in the output (but can be)