Selecting the correct data parts and types in Tableau

This tutorial helps you understand the different date options in Tableau and how to select the date part/type you want without having to change from the default each type

Understanding and selecting the appropriate date type in Tableau

Whenever you bring a date field into the view on Tableau you've probably noticed that it defaults to a year and you end up having to change the date as follows:

<Insert GIF showing date / edit date)>

It can also be a little confusing that they're are multiple options for each date part so in this tutorial we show you how to pick the correct date type first time!

The first thing to point out is that Tableau automatically selects the date part you want (Year by default) when you drag a date field onto the view, you can actually select the one you want when holding the right rather than the left mouse button when you drag a date field into the view.

This is how it looks when you do that:

<Insert screenshot or GIF>

Now we can choose the date type we want rather than having to add the field then go in and edit it! I almost always add dates in this way now.

Date part/type options:

Order Date (Measures):

This add all the individual dates in your data but Tableau will understand that they are dates and you'll be able to edit the axis to edit the date range and distance between dates etc. You would only tend to use this if you wanted to show or visualise data at the date level in your data which would typically be days.

Order Date (Dimensions):

This option adds all of your dates again but this time each one is a discrete point on your chart, this means you aren't able to edit the axis or change the date range etc. This usually ends with a really long chart with an axis mark for every single date in your data.

Discrete Date Parts (the blue ones)

The second section lists the differing discrete dart parts, these are typically used when you want to break your data down by the shown date type, as an example if you select months it will show the data for each individual month but not break it down by years.

YEAR, QUARTER, MONTH

These should hopefully all be pretty self explanatory, they display your data by Year, Quarter or Month.

DAY

These are the same as above however note that they break your data down by the day of the month (day 1-31) rather than showing individual day names as sometimes expected.

WEEK

As above but shows the week of the year from 1-52.

WEEKDAY

This shows the actual day name (Monday to Sunday) and is sometimes what people expect DAY to show.

MY

This is slightly different as it shows the Month and the Year, so your data is broken down into specific months/years whereas the above options would show you data for all years.

MDY

As above but this breaks it down by day, month and year. It's pretty much the same as Order Date (Discrete) in most cases but formats the dates with the month and day names.

Date Measures:

These are used when you don't want to bring in actual dates but want a count of dates or to see the first and last date. They're mostly useful for checking your data or for adding to text fields or tooltips to give some context about your data.

For example we often use Min or Max to check the date ranges and CNTD to check if we're missing any dates in our data (e.g. a year should have 365 distinct dates, if it doesn't then some days are missing).

CNT - Counts the number of dates in your data, useful for seeing if there are any nulls or missing dates as it should match your number of records.

CNTD - Counts the distinct number of dates in your data excluding duplicates, again mostly used for checking if any dates are missing from your data.

MIN - Shows the earliest date in your data, also useful for checking the ranges of dates in your data but can also be used to see when a customer first ordered or the first date for a given dimensions.

MAX - As above but gives the latest date in your data.

Continuous Date Parts:

Each of these will show your data in a continuous date order, the main difference to the discrete options is that even if you select Quarter, Month, Week, Day etc. the data is not broken down by those individual selections but instead it sets the level at which your data is plotted.

For example, if you picked Year and you had 3 years worth of data it would plot 3 data points, one for each year and this is pretty much the same as the discrete option. However, if you selected Month it would actually plot 36 data points (12 months for each year) whereas the discrete options would only show a data point for each month and would aggregate the data for all years within each month.

These are typically what you would use when working with time series data and looking at trends over time etc.

The options available are Year, Quarter, Month, Week and Day and should all hopefully be self explanatory.

ATTR:

The final options is to just show the individual dates within your data in the format they appear. You'd only really use this when you're looking at data at the lowest level it appears (e.g. by row id, order id etc) to see individual dates as when there are multiple dates for a row/column in your data you'll see an * rather than the individual date.

Summary

Right click when dragging dates to select the relevant option.

When working with time series use the continuous options at the level you want.

When comparing data irrespective of individual date use the discrete options, e.g. when comparing data across months.

When checking data use the measures.

If you want to change the data part/type you can click the little arrow on the pill and choose a new one as above or try the custom option for a bit more flexibility.