We have a table with the following values:
ItemName Qty F Bit Date
Item1 100 1/1/2011
Item2 150 1/5/2011
Item3 200 1/14/2011
Item4 250 1/20/2011
Item5 1000 2/1/2011
In a MDX query we require to filter the data based on the date range. Say if we require to fetch the items and its qty for the date range 01/01/2011 to 01/31/2011 we use the following MDX query:
SELECT
NON Empty
{[Final Report View For Scorecards].[F Bit Date].Children} ON ROWS,
NON Empty
{[Measures].[Qty]} ON COLUMNS
FROM
(
SELECT
(
{[Final Report View For Scorecards].[F Bit Date].&[2011-01-01T00:00:00] :
[Final Report View For Scorecards].[F Bit Date].&[2011-01-31T00:00:00]}
) ON COLUMNS
FROM [FinalReportView]
)
Here when the FromDate and ToDate parameters are passed as 01/01/2011 and 01/20/2011, the items 1 to 4 with their respective qty's are retrieved correctly. But when the FromDate and ToDate are passed as 01/01/2011 and 01/31/2011 (or) 01/01/2011 and 01/19/2011, it returns even the value of Item5 which is wrong. i.e., only when the exact dates available in the table are passed as parameters, it returns the correct result. But when dates that are not available in the table is passed, the entire dataset is returned.
It is the same when 'FILTER' is used.
Any pointers to this issue?