Decoding Dates in Tableau (Datepart and Datevalue)

Today, we’ll explore the difference between DATEPART and DATEVALUE in Tableau. At times, we need to compare performance across specific time periods; other times, we simply want to observe trends over time. That’s where DATEPART and DATEVALUE come into play.

DATEPART: DATEPART breaks a date into specific components like month, quarter, or year. It returns discrete values, meaning each time period stands alone (e.g., Jan, Feb, Mar). In Tableau, it is represented in blue color.

DATEVALUE: Date value is a flow of values over time and is continuous in nature, so it is represented in a green color and used to show the trend over time.

Let’s go deeper and try to understand it with the examples. Let’s say we have four years of sales data, and we want to analyze the overall monthly sales. To do this in Tableau, we use the DATEPART function. Below are some steps to understand how it works:

Step 1: Drag order date into the columns shelf and sales into the rows shelf. Simply click the dropdown on the Order Date field, and choose ‘Month’ from the available options like Year, Quarter, Month, etc. This groups sales by each calendar month aggregating all Januaries, Februaries, and so on regardless of the year.”

Finally this is how your visualization would look, here, you can easily compare monthly sales across all four years.


Now, you want to see the trend over time and have an overview of sales over four years in each month, so for that we will use DATEVALUE function, below are the steps to follow:

Step1: Again, drag order date into the Columns shelf and Sales into the Rows shelf. Now go to the Order Date dropdown; this time, choose ‘Month’ from the second section of options (continuous).

You will see the order date pill turn green.

Go to the marks card and select the line, now you can see the trend over the months for all four years.

Note: When you click on the date dropdown, the first set of Year, Quarter, Month, and so on is used with DATEPART, and the second set is used with DATEVALUE.

Thanks for stopping by.

Similar Posts

Leave a Reply

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