KNOWLEDGE BASE

Numeric with Leading Zeros Format Option For Discrete Week of Date Does Not Work


Published: 04 Jan 2018
Last Modified Date: 08 Jan 2018

Issue

When selecting a date format for discrete WEEK([datefield]), choosing 'Numeric' or 'Numeric with Leading Zeros' does not change the date format.

Environment

Tableau Desktop 10.4

Resolution

As a possible workaround, the following string calculations may achieve the intended result:

Option 1 

For the first 9 numbers in a list.
IF DATEPART('week',[Order Date]) > 9 
THEN DATENAME('week',[Order Date]) 
ELSE "0" + DATENAME('week',[Order Date]) 
END

Option 2

Try creating a calculated field similar to:
"Week" + ' ' + str(DATEPART('week',[Order Date])) + ".00" 

Cause

This is a known issue that will be addressed in the future.
Did this article resolve the issue?