Technical data
Using Built-in Functio ns in Analytic Models Chapter 11
MOD
Syntax
MOD(X, Y)
Description
The MOD function returns the remainder of X divided by Y. If Y is zero, MOD returns an error value.
Returns
The remainder of X divided by Y. If Y is zero, MOD returns an error value.
Example
The following
examples employ the MOD built-in function:
• MOD(10, 4) returns 2.
• MOD(15, 10) returns 5.
• MOD(15, 5) returns 0.
• MOD(15, 0) returns an error value.
MONTH
Syntax
MONTH({Date})
Description
The MONTH function returns the m onth of Date.IfDate is omitted, the function returns the month of the
calculation date.
Returns
The month of D
ate.IfDate is omitted, the function returns the month of t he calculation date.
Example
If A = 2004/03/15 and B = 2005/06/22, MONTH(A) returns 3 and MONTH(B) returns 6.
Now suppose that an analytic model contains a data cube called MONTH_EXAMPLE that uses a dimension
called MONTHS and has the formula MONTH_EXAMPLE = MONTH( ). Because the argument is omitted,
MONTH returns the month for each date in the MONTHS dimension.
Following is
a useful example of the MONTH function. Suppose that you define a data cube called
MONTHLY_SAL
ES that uses a dimension called MONTHS. You want to calculate the average sales
for each mont
h of the year. In other words, you want to know the average sales for the first month of
each year, t
he average sales for the second month of each year, and so on. To do this, create a dimension
called MONT
H_NUM that contains members numbered 1 to 12. Then define a data cube called
AVG_SALES_
BY_MONTH that uses the MONTH_NUM dimension. Finally, enter the following formula for
the AVG_SAL
ES_BY_MONTH cube:
DAVG(MONTH
S, MONTHLY_SALES, MONTH( ) = MEMBER(MONTH_NUM))
174 Copyright © 1988-2007, Oracl e. All rights reserved.