Day of Week

I'm trying to find a "day of week" function. Essentially i don't want to count hours on the weekend. Any ideas? It seems like it should just be a formula dayofweek(start()) but i can't find anything like that. Cheers, H

Best Answer

  • There's a new calculation function due in the 2015.4 release (Oct) which does this; the details are...

    "WEEDAY(date, #). This new function has been added. It returns the day of the week (e.g. 1, 2, 3, 4, 5, 6 or 7) based on a date or the current day in a time dimension. By default it assumes that the #1 day is a monday, so WEEKDAY (12/25/2015) returns 5, since it's a Friday. You can decide that the 1st day of the week should be a Tuesday, then you'll write: WEEKDAY (12/25/2015,2) and it will return 4 - Friday is #4 if Tuesday is #1"
     

Answers

  • I had a similar requirement and couldn't find a "day of week" function.

    There may be a better way but my workaround was to create a calendar module which had a daily time period. I added a line item called "Day of Week" with the below formula (in this example the start date of my model was a Wednesday with 1 representing a Monday and 7 a Sunday).

    IF START() = DATE([start date of model]) THEN 3 ELSE IF PREVIOUS(Day of Week) = 7 THEN 1 ELSE PREVIOUS(Day of Week) + 1

    The above could be a probelm if the start date of your model changes but it allowed me to use this as a lookup wherver I needed to take into account the day of the week.