Description:
This function returns the day of a date, represented by a serial number. The day is given as an integer ranging from 1 to 31.
Syntax: DAY (Serial_number)
Remarks
Example
The DAY 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 day that corresponds with the day element of the serial number, in this case it is possible to access the "DAY" with the help of this function. This function displays the value of the DAY as a number corresponding to the serial date which in turn is counted forward from 1stJanuary, 1900 which is the base date for the "DAY" and the other related functions too.
=DAY (37459) |
-Serial Number is converted to the date, and the day from the date determined is returned as the result. (day returned for this serial date = 22). |
=DAY("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 day from the "DAY' 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, "DayofSerialDate" 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 "DayofSerialDate" member by calculating the "DAY" value from the "Serial Date" number supplied as a parameter to the "DAY" function which returns the desired result. The DAY 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 "Day" element in the date which is thus calculated.