Skip to main content

Selecting a Member Relative to Today (Time Levels)

Selecting a Member Relative to Today (Time Levels)

For date/time levels, the system supports a special member called NOW, which uses the current date (runtime) and accesses the appropriate member of the level.

For example, the following query accesses the current year in the Year dimension:

SELECT birthd.year.NOW ON 1 FROM demomdx
 
2011                                      9

For another example:

SELECT birthd.[quarter year].NOW ON 1 FROM demomdx

                                          
Q2 2011                                   5

Business Intelligence also supports variations that indicate members that are offset from NOW. For example, [NOW-1] finds the member that precedes NOW by one position:

SELECT birthd.[quarter year].[NOW-1] ON 1 FROM demomdx

                                          
Q1 2011                                   1

You can use these variations within ranges of members like the following:

SELECT birthd.[quarter year].[now-1]:birthd.[quarter year].now ON 1 FROM demomdx

                                          
1 Q1 2011                                 1
2 Q2 2011                                 5

For more details, see NOW Member for Date/Time Levels in the InterSystems MDX Reference.

FeedbackOpens in a new tab