You are currently browsing the daily archive for May 19, 2010.

A lot of times the MDX query needs to look at current date/today date/system date as the reference member. There is no function equivalent to TSQL getdate(), but you can use the following piece of cide snippet to solve the purpose:

StrToMember(“[Date].[Date].[" + Format(now(), "yyyyMMdd") + "]“)

As an example, if you want to see the Sales for the last 7 days from the system date:

SELECT
 [Measures].[Sales]  ON COLUMNS,
 LastPeriods(7,  StrToMember(“[Date].[Date].[" + Format(now(), "dd-MM-yyyy") + "]“) )  ON ROWS
FROM [Cube]

Timeline

May 2010
M T W T F S S
« Mar   Jul »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Blog Stats

  • 9,380 hits
Follow

Get every new post delivered to your Inbox.