ISO-8601 Week-Based Calendar

The ISO-8601 Week-Based Calendar is an international standard for date-related data. The purpose of the ISO-8601 calendar is to provide a consistent and clear method to represent and calculate dates. ISO-8601 calendars divide dates into Years, Quarters, Weeks, and Week Days. Unlike the Gregorian calendar, ISO-8601 calendars have a consistent number of weeks in each quarter and a consistent number of days each week, making the ISO-8601 calendar popular when calculating retail and financial dates.

Set ISO-8601 as the default calendar

To set the ISO 8601 calendar for a data source, follow these steps:

  1. Right-click (Control-click on Mac) the data source in the Data pane to open the Date Properties dialog box.

  2. Set the Default calendar field to ISO-8601 Week-based .

For each date field on the shelf, you can set the calendar type separately. In the shelf, right-click a date dimension (Ctrl-click on Mac), and select ISO-8601 Week-Based.

Whether a given level of a date dimension is affected by the use of the Fiscal Calendar depends on the specific case.

Gregorian Date Level ISO-8601 Date Level Differences between ISO-8601 and Standard Gregorian calendars
Year ISOYEAR ISO-8601 years always start on the first Monday closest to January 1st. This may mean that the year does not start until January 4th in some cases, or may start in late December in others. Gregorian calendars always start the year on the 1st of January. This can cause some discrepancy in years between the two calendar systems when very close to the beginning of January.
Quarter ISOQUARTER

The first three quarters in the ISO-8601 always have 13 weeks in them, with the last Quarter having either 13 or 14 weeks in it, depending upon the start of the next ISO-8601 year.

Month   The ISO-8601 Week-Based calendar does not use Months. Many retail and financial systems divide ISO-8601 Quarters into three segments of 4-4-5 weeks, though other segment systems also exist.
Week Number ISOWEEK

All weeks in the ISO-8601 Week-Based calendar have exactly 7 days, start on a Monday, and each week belongs to single year. Unlike the Gregorian calendar, there are no weeks that extend across years. Each ISO-8601 year is either a Long or a Short year, with 52 or 53 weeks depending on when the ISO-8601 year begins.

Day   The ISO-8601 Week-Based calendar does not use Days.
Weekday ISOWEEKDAY ISO-8601 Weekdays always start on Monday.

Date Functions that support ISO-8601

When a date dimension is using the ISO-8601 Week-Based calendar, only the following date functions will reflect the ISO-8601 Week-Based calendar.

DATEADD and DATEDIFF

If the DATEADD and DATEDIFF calculations are called with a non- ISO-8601 date value (such as day or month), the resulting field will truncate an ISO-8601 date to the nearest ISO level. For example, adding one month to an ISO-8601 date will be reflected in the iso-week changing.

DATENAME

When using DATENAME, the resulting calculation will return Gregorian dates unless you use the iso-year,iso-quarter, iso-week, or iso-weekday date parts.

DATEPART

When using DATEPART, the resulting calculation will return Gregorian dates unless you use the iso-year,iso-quarter, iso-week, or iso-weekday date parts.

DATETRUNC

The DATETRUNC calculation will truncate an ISO-8601 date to the nearest ISO level. For example, as you can see in the image below, even though the ISO-8601 does not use Months, truncating the ISO date at 'month' will display the first iso-week of the Gregorian month.

Create a 4-4-5 calendar with ISO-8601 date functions

The ISO-8601 Week-Based calendar does not use Months. Many retail and financial systems divide ISO-8601 Quarters into three segments of 4-4-5 weeks, though other segment systems also exist.

Follow along with these steps to learn how to implement a 4-4-5 calendar in Tableau Desktop.

Step 1: Set up the Visualization

  1. Open Tableau Desktop and connect to the Sample-Superstore saved data source.

  2. Set ISO-8601 as the default calendar.

  3. Navigate to a new worksheet.

  4. From the Data pane, under Dimensions, drag Order Date to the Rows shelf.

  5. On the Rows shelf, click the '+' icon on ISOYEAR(Order Date).

    ISOQUARTER(Order Date) is added to the shelf.

  6. From the Data pane, under Measures, drag Sales to the Columns shelf.

Step 2: Find the number of weeks in each quarter

In a 4-4-5 segment calendar, each quarter is divided into 3 segments with 4 or 5 weeks in them. We must find how many weeks are in each quarter in order to divide them into segments.

  1. Select Analysis > Create Calculated Field.

  2. Name the calculated field Weeks in Quarter

  3. Enter the following calculation in the calculation dialog

    DATEPART('iso-quarter', [Order Date])*13 - DATEPART('iso-week', [Order Date])

Step 3: Create the 4-4-5 calendar calculation

  1. Select Analysis > Create Calculated Field.

  2. Name the calculated field 4-4-5 Segment

  3. Enter the following calculation in the calculation dialog

    IF([Weeks in Quarter] > 8) THEN "1" ELSEIF ([Weeks in Quarter] > 4) THEN "2" ELSE "3" END

  4. From the data pane, drag the 4-4-5 Segment calculated field to the Rows shelf.

See Also

Dates and Times(Link opens in a new window)

Date Functions(Link opens in a new window)

 

Thanks for your feedback!