KNOWLEDGE BASE

Unexpected Results with Custom Date Formatting for Integers


Published: 11 Apr 2018
Last Modified Date: 12 Apr 2018

Issue

When using custom date formatting with a DATEPART, unexpected results are being returned.

Environment

Tableau Desktop

Resolution

To ensure Tableau treats the results of the DATEPART as desired, either change the field type to Date, or use DATETRUNC instead of DATEPART.

Cause

This behavior is as designed. By default, the results of a DATEPART will be in a numerical format (e.g., integer). The behavior of date formatting for number fields is different from the behavior of date formatting for date fields.
Did this article resolve the issue?