# Database Discussions > MDX and Analysis Services >  MDX selection between two dates

## tovi

I need to write MDX query that select data between two dates.
The problem is that the dates I get from the user are not necessarily exists in my date dimension.

I tried implementing it by the following code, but it didn't work correctly. 
(The dates in the example : 2008-05, 2009-05 ,are the input dates given by the user, and they are not necessarily exists in the Dim Date table.)
Here is my code:

SELECT [Dim_Customer].Members ON COLUMNS,
[Measures].[DPM] ON ROWS
FROM [Cube]
WHERE [Dim Date].[Calendar].[Year Month].[2008-05]:[Dim Date].[Calendar].[Year Month].[2009-05]

Thanks in advance.
Tovi

----------


## Island1

Are you saying that 1) the Date dim table is missing dates (that is, does not include all dates), or are you saying that your query is attempting to select data at a different date _granularity_ than exists within the Date dim table?

Thanks.

Bill

----------

