Week days

Even though the Period Table automatically task added a number of additional, useful columns to the PeriodTable, it notably did not add Week days.

To add Week days to the PeriodTable, you can add a Script task to the ETL project that makes use of the DAYOFWEEK function and a CASE statement:

mceclip0.png

The required script:

alter table PeriodTable add column WeekDayNumber = {DAYOFWEEK(TheDate)}
alter table PeriodTable add column WeekDayName =
{
CASE DAYOFWEEK(TheDate)
WHEN 1 THEN 'Monday'
WHEN 2 THEN 'Tuesday'
WHEN 3 THEN 'Wednesday'
WHEN 4 THEN 'Thursday'
WHEN 5 THEN 'Friday'
WHEN 6 THEN 'Saturday'
WHEN 7 THEN 'Sunday'
ELSE 'none'
END
}

When this script has been run as part of the ETL project, it will produce two extra columns in the PeriodTable. You can verify this with the InMemory Query Tool:

mceclip1.png

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.