Skip to main content
100%

Tableau Magic to cast Date_Id to a convenient date format, assumed YYYYMMDD

✓ Published0🌍 Public
BBBischof
Last edited Aug 22, 2018
Created on Aug 22, 2018

This example shows how to convert a numeric `date_id` field in the assumed `YYYYMMDD` format into a proper Tableau date type. The calculation uses nested `DATEADD` functions to reconstruct the date by extracting the day, month, and year from the integer—the day from `[date_id] % 100`, the month from the middle two digits, and the year from the first four digits—then offsets from a fixed `#1900-01-01#` reference. It relies on Tableau’s `DATE` and `DATEADD` functions, with `INT` for integer division, to perform the transformation. The approach is tailored for data sources where date identifiers are stored as compact numeric codes rather than native date fields.

AI-generated description

Similar vizzes