Why Is My Date Turning Into A Bar? (Tableau Troubleshooting)

,

Formatting dates in Tableau can be frustrating. There’s a ton of options, but it’s not always obvious what each one does! If you’re trying to turn a date field into a single date value, but getting weird bars instead, this post – part of my ongoing Tableau Troubleshooting series – is for you. We’ll look at why this happens and walk through how to format dates exactly the way you want them.

The Situation

Let’s say I’m building a sales table in Tableau, using the superstore data set. I’ve filtered down to one category, and now I want to break it down further by order date, so that I can eventually show sales totals by day.

I’ll add order date to my rows shelf. This looks pretty good, but Tableau defaults all date fields to year. I want to break it down by the actual date, not just the year, so we’re not quite there yet.

Now, I’ll right click the “Order Date” pill to open the options drop-down. And hey, look! There’s exactly what I want – individual dates.

Here’s where it’s easy to get confused and lost. When I click on this “Day” option, my nice text table suddenly goes crazy.

This is not at all what I wanted. I just wanted to see individual dates as rows in my table! What went wrong, and how do we fix it?

Why This Happens

The reason this happens has two parts.

  • Part 1: Tableau can treat dates as either continuous or discrete, and handles each type very differently.
  • Part 2: Some commonly-used date formatting options are hidden behind multiple menu levels.

Let’s look at part 1 first.

When we pulled up that drop-down options menu (by right clicking the date pill), did you notice how the format options are divided into two sections?

There’s some confusing labelling going on here, because both the top and the bottom sections contain mostly the same options – year, quarter, month, etc – but the examples are different, and Tableau treats the two sections differently.

The options in the blue section, on top, default to being discrete dimensions. (Blue pills). When they’re in the rows shelf of a table, they act like any other dimension, and break the table down into more rows. This is the behavior we were looking for!

The options in the green section, at the bottom, default to being continuous measures. (Green pills). When they’re in the rows shelf of a table, they act like any other measure, and are used as the values for creating a visual. This is where the weird bars are coming from – Tableau is trying to use the dates as graphable values.

(The “Exact Date” option is separated from the green section by a line on the menu, but behaves the same way as the other green options).

Here’s where the sections get even weirder. When you click “More” in either section and then select “Custom”, you get a pop-up with an expanded list of options. These options are the exact same regardless of which section you click the “More” link from, and yield the exact same results.

This pop-up has several more options, and gives a lot more control, than the default dropdown.

The Solution

There are several easy ways to fix the weird bar problem, but they all come down to the same core idea: Make the date discrete. If you want to show individual dates in a table (or some other visual that’s not just a graph axis), you need to use a discrete data type.

Luckily, we can easily flip whether a date pill is discrete or not. Here’s the view from earlier, just after I switched the date type to “Day (May 8, 2015)”.

If you click “Discrete” from the menu options, the date formatting type won’t change – however, the date pill will change to be a discrete dimension. This brings us back to the setup we want.

If you want a date that defaults to a 1/2/2025 format, try clicking “Exact Date” first and then toggling to discrete.

(For full control over your date formatting, you can select “format” from this same menu. More on how to do that in this post).

Alternatively, you can gain full control over your date type from the start by going straight to one of the “more” options, selecting “Custom”, and using the full control options there.

This lets you go straight to the date type you want without worrying about defaults.

On the Tableau Online editor, you’ll notice that “M/D/Y” (or “D/M/Y”, depending on your localization settings) is actually one of the options that shows up under “More” without clicking “Custom”. Here’s hoping that we get that in Tableau Desktop one day!

Conclusion

Dates can be finicky and fussy in Tableau, but understanding the difference between dimension dates and measure dates (and their related attributes, discrete and continuous) goes a long way towards making them smoother to work with.

PS: If you enjoyed this post, or have a question you’d like me to tackle in a future Tableau Troubleshooting post, please leave a comment to let me know!

Let’s keep in touch! New tips, tricks, and tutorials are posted about once a week – sign up to get them straight to your inbox!

I don’t spam! Read the privacy policy for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *