Description:
This function returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.
Syntax: WEEKDAY (serial_number)
Remarks
Example
The WEEKDAY function can be used in any database where you have stored values for the number of the serial date and you want to return the day of the week element from that serial date, in this case it's possible to access this value with the help of this function.
This function displays the day as a number derived from the computation of the parameter supplied to this function.
=WEEKDAY (29058) |
-The parameter entered here for serial date is converted to a date and the day element in the date thus computed is returned by this function (The weekday returned for this example is = 1) |
=WEEKDAY ("range reference") |
-The parameter for "Serial Date" can be specified from a given range instead of being fed into the formula directly and the day element can be calculated based on the value thus passed to the formula. |
Let us take the example of the HR database in PowerOLAP where we need to calculate the weekday element value based on the information provided by the "Serial Date" parameter that is supplied to the function. In this case, we have written a formula in the appropriate cube in PowerOLAP, pulling in the value from the "Serial Date" field and then writing that value to this formula in order to calculate the result of the "WEEKDAY" function. The formula then calculates the "Weekday" element as a number which corresponds to the index of the day in the week, which is from 1 to 7.
The formula above writes values into the "Staff Date Lookup" cube to the "Staff Date Lookup" dimension into the member named "WEEKDAY" by calculating the appropriate value from the "Serial Date" member that is the parameter supplied and that helps the function to determine the "Weekday".