How Do I Extract Day of Week From A Date Column?

Hello:

I need help with the following issue:

I have a DOWNTIME_DATE date value column. I want to compare this value to the the current date and from that comparison create a new calculated column that shows an interger between 1 and 7 based on if were x number of days into the current year week or default to 7 if were already past the current year week. I want to create this value to help calculate a weekly average. I need to be able to either divide by a full week (7 days) or divide by the number of days were in to the current week (1-6 days)

Example #1

DOWNTIME_DATE = 9/16/2013

     - This date would produce a value of 7 (full week or 7 days) for the calculated column since this date is in a preceding year week (week 38).

Example #2

DOWNTIME_DATE = 9/26/2013

     - This date would produce a value of 4 (4th day of current year week) for the calulated column since this date falls into the current year week (as of the time of this post)

Please let me know if more clarification is needed. Remember to check that were in the current year since my data set will contain a lot of historical data from perevious years. I really appreciate your help!

Login