Learning
Community
Open Exchange
Global Masters
InterSystems IRIS Data Platform 2019.3 / Application Development / InterSystems MDX Reference / MDX Functions / %TIMERANGE
Previous section   Next section

%TIMERANGE

Enables you to define a range of time members, possibly open-ended. This function is an InterSystems extension to MDX.

Returned Type

This function returns a member.

Syntax and Details

%TIMERANGE(start_member,end_member,keyword)
Where:
  • start_member is an optional expression that evaluates to a member of a time level. If you omit this, the system uses the earliest member of this level.
  • end_member is an optional expression that evaluates to a member of a time level. If you omit this, the system uses the latest member of this level.
  • keyword is optional and is either INCLUSIVE or EXCLUSIVE
    The default is INCLUSIVE.
You must specify start_member, end_member, or both.

Example

The following example uses both start_member and end_member:
SELECT NON EMPTY DateOfSale.YearSold.MEMBERS ON 1 FROM holefoods 
WHERE %TIMERANGE(DateOfSale.YearSold.&[2009],DateOfSale.YearSold.&[2011])
 
 
1 2009                                  179
2 2010                                  203
3 2011                                  224
The next example shows an open-ended range:
SELECT NON EMPTY DateOfSale.YearSold.MEMBERS ON 1 FROM holefoods 
WHERE %TIMERANGE(DateOfSale.YearSold.&[2009])
 
 
1 2009                                  179
2 2010                                  203
3 2011                                  224
4 2012                                  114
The next example shows another open-ended range, this time using the EXCLUSIVE keyword:
SELECT NON EMPTY DateOfSale.YearSold.MEMBERS ON 1 FROM holefoods 
WHERE %TIMERANGE(,DateOfSale.YearSold.&[2009],EXCLUSIVE)
 
 
1 2007                                  124
2 2008                                  156
Previous section   Next section