Description:
This function returns the month of a date represented by a serial number. The month is given as an integer, ranging from 1 (January) to 12 (December).
Syntax: MONTH (serial_number)
Remarks
Example
The MONTH function can be used in any database where you have stored values for the serial number which is the number of days counted from 1/1/1900 as explained above. If you want to return the month that corresponds with the month element of the serial number, in this case it is possible to access this value with the help of this function. This function displays the value of the MONTH as a number corresponding to the serial date which in turn is counted forward from 1st January, 1900 which is the base date for the "MONTH" and the other related functions too.
=MONTH (37459) |
- Serial Number is converted to the date, and the month from the date determined is returned as the result. In this example it will return a value of 7 which is the equivalent of the month of July. |
=MONTH ("range reference") |
- Serial number converted to Date as the serial number is counted ahead from 1st January, 1900 till the serial number specified in the given range and the day for that serial date is returned by this function. |
Let us take the example of the HR database in PowerOLAP which has data which that gives the information for the serial date value and this is the parameter used to calculate the month from the "MONTH" function. In this case we can write a formula in the appropriate cube in PowerOLAP to pull in values from the member that forms the parameter here, which is "Serial Date" and then write this to the formula and use it to derive the values for the another member of the dimension namely, "MonthOfSerialDate" and apart from this example you can even do this for a different dimension in a different cube.
The formula above writes values into the "Staff Date Lookup" cube to the "Staff Date Lookup" dimension into the "MonthOfSerialDate" member by calculating the "Month" value from the "Serial Date" number supplied as a parameter to the "MONTH" function which returns the desired result. The MONTH function takes the "Serial Date" as a parameter, and captures the date which corresponds to that serial number by counting forward from 1st January, 1900 till the serial date, and returns the "Month" element in the date which is thus calculated.