KNOWLEDGE BASE

Week Number is Incorrect for European Locales


Published: 01 Aug 2014
Last Modified Date: 31 Jul 2018

Issue

When using Tableau Desktop in a European locale, the week number might not display as expected. For example, the week of January, 4th to 10th, 2016 might display as Week 2 in Tableau Desktop instead of Week 1.

Environment

Tableau Desktop

Resolution

CLICK TO EXPAND OPTION 1
Option 1: Upgrade to Tableau Desktop 2018.2
As of the release of Tableau Desktop 2018.2, date functions now support ISO 8601 dates. For more information about the feature, see Gregorian Calendar vs. ISO 8601 Standard in Tableau Help. 
To use  ISO 8601 dates, upgrade to Tableau Desktop 2018.2 or a later version. For more information, see Upgrading Tableau Desktop in Tableau Help.
 
CLICK TO EXPAND OPTION 2
Option 2: Create calculated fields
As a workaround, use calculated fields to convert week numbering to the ISO 8601 standard.

Please note that the following instructions are based on sample data and can be reviewed in the workbook attached below.

Step 1: Create a Calculated Field

  1. Select Analysis > Create Calculated field.
  2. Name the calculated field "ISO 8601 Week".
  3. Enter the following formula: 
    ROUND((DATEADD('day', 3, DATETRUNC('week',[Date]))-
    DATEADD('day', 3, DATETRUNC('year', DATEADD('day', 3, DATETRUNC('week',[Date])))) +
    DATEPART('weekday', DATEADD('day', 2, DATETRUNC('year', DATETRUNC('week',[Date]))))
    -4) / 7 + 1,0)
Note: Change [Date] with the date field of your own dataset. 

Step 2:  Create a Calculated Field

  1. Select Analysis > Create Calculated field.
  2. Name the calculated field "Monday of Week".
  3. Enter the following formula: 
    DATETRUNC('week',[Date]-1)+1 
Note: Change [Date] with the date field of your own dataset. 

Step 3: Build the View

Drag "Monday of Week" and "ISO 8601 Week" to the Columns shelf. Ensure "ISO 8601 Week" is set as Discrete
 

Cause

Tableau Desktop uses US standards for week numbers. The ability to format dates according to the ISO 8601 standard was added to Tableau Desktop 2018.2.
Did this article resolve the issue?