| MDX-How do you write query that uses execution date/time (NOW()) as a parameter? |
| Written by Vidas Matelis | |||
| Sunday, 15 April 2007 17:27 | |||
|
Q: How do you write MDX query that uses execution date/time as a parameter? A: You can make MDX query that use function now() to get execution date and use it to define date dimension member. You should build a string that defines dimension member in proper format and then convert that string to member using StrToMember function. While building member string a lot depends on how your date dimension is defined. This example is build using Adventure Works database where date member looks like [Date].[Date].[April 15, 2007]:
Other date format options:
So if your date is format like 20070415, then you can use format: Note mm is different from MM, mm is ued to define minutes! Note: After this FAQ was released, additional information about this issue was published by Mosha Pasumansky here.
|
Most read
- How to install Adventure Works SQL DW and Analysis Services 2005/2008 sample database and project
- MDX-How can I get Last (Previous) Year to Date (YTD) values?
- Analysis Services 2005 error: Errors in the metadata manager. The attribute with ID of ., Name of . refer
- MDX-How do you format or round KPI expression value?
- MDX-How do you calculate monthly average of one year, optionally including empty months?
Top Rated
- How to install Adventure Works SQL DW and Analysis Services 2005/2008 sample database and project
- Analysis Services 2005 XMLA script to add/drop existing partition aggregate
- Why In Reporting Services MDX query disappears after leaving "Data" tab.
- When accessing calculation tab in BIDS I am getting error Unexpected error occurred
- In an MDX query how can I get the top 3 sales years based on the order quantity?
- What TCP port SQL Server Analysis Services 2005 uses
- How to calculate YTD monthly average and compare it over several years for the same selected month
- Analysis Services 2005 error: Errors in the metadata manager. The attribute with ID of ., Name of . refer




