Description:
This function returns the hour of a time value. The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
Syntax : HOUR (Serial_number)
Remarks
Example
The HOUR 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 "hour" that corresponds with the serial number, in this case it is possible to access the "HOUR" with the help of this function. This function displays the value of the hour as a number corresponding to the serial date which in turn is counted forward from 1stJanuary, 1900. If you wish to see an exact hour, other than "0" then represent the serial date in decimals.
=HOUR (29058.90) |
- Serial Number is checked for the hour, and the hour element from the serial number is determined and returned as the result. (Hour returned for this serial date = 21) |
=HOUR ("range reference") |
- Serial Number in the range referred to, is checked for the hour, and the hour element from the serial number is determined and returned as the result. |
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 hour from the "Hour" 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, "Hour" 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 "Hour" member by calculating the "Hour" value from the "Serial Date" number supplied as a parameter to the "HOUR" function which returns the desired result. The Hour function takes the "Serial Date" as a parameter, and captures the hour in that date, depending on the decimal values in the parameter supplied, because any value without a decimal will return a "0" hour.