During the first week of training at the Data School, we covered a variety of techniques for planning and preparing data to ensure we have a clean usable dataset for further analysis.
An important aspect of the data preparation, particularly in tools like Tableau, is mastering dates. They allow us to visualize time-related data effectively.
In this blog post, we will explore two of the functions Tableau has to offer, along with examples of how to use them.
MAKEDATE: Creating date from Components
This function allows you to create date values based on specific components, it creates a date from a year, month and a day of the year.
Example:
MAKDEDATE(2025, 6, 30) // Creates the date June 20, 2025
DATEADD: Adding or Subtracting Dates
This function is used to add or subtract a specific number of date parts to a date.
The DATEADD outputs a date value after performing the operation.
For example:
DATEADD( 'month' , 5 [Order Date])
So if your "Order Date" is '2025-06-07'. Applying DATEADD('month', 5, [Order Date])
adds 5 months to this date, resulting in '2025-11-07'.
In conclusion, being able to successfully utilize these functions opens up a world of possibilities for analyzing and visualizing your data. Understanding the data types they output is crucial for accurate calculations and visualizations.