Get startedGet started for free

Visualizing dates

1. Visualizing dates

This time we’ve connected to a new dataset. This new data contains health statistics from the United Nations Statistics Division. Let’s first take a quick look at our data. If we click on View Data we’ll see that we have geographic data about the continent and country, the number of births and gender, and also a date variable. Combining all this we can create a visualization that gives us an idea of the evolution of births in a country over the years. If we go back to the sheet and look at the data pane you can see that the date dimension is marked with a calendar icon. To create the line chart we need to drag date to Columns and the measure Births to Rows. Let’s also filter by dragging Country to the Filters shelve and selecting Portugal. Notice how Tableau has automatically aggregated the data for every year. So, there is a datapoint with the total number of births for every year and they are all connected through the line chart. This visualization gives us a good idea of the evolution of Portuguese births over the years. We know that our data is much more granular than that. There’s data down to the month-level. Let’s explore how we can get down to that level of granularity. We can click on the arrow next to YEAR(Date) to make a dropdown menu appear. You’ll see that there are two sections that are responsible for time. There’s this section which has year, quarter, month, day and there’s this section which also has these values. So what’s the difference? Let’s first click on month in the first section. Now we no longer have years at the bottom but months. There's only one January, one February and so on though, while there are multiple years in our data. In our case, that doesn’t make sense since we’re interested in the evolution over time. What is happening is that Tableau considers month as a dimension, meaning a discrete value, and aggregates the number of births for every month. You can see this by the blue color. So how do we get to a timeline at the bottom? Let’s go to the dropdown menu and select the second month. Now, month is recognized as a measure, meaning a continuous value. Notice that it has turned green. This is what we wanted. We can see values for each month in each year. So pay attention when selecting the granularity level for dates. The first section makes it discrete, the second continuous. Over to you!

2. Let's practice!