TabCharts.com

An on-line library for creating different chart types in Tableau



Line Chart






Tableau Canvas Layout:





A typical line chart will have a Date field on the Columns and a Measure on the Rows.

Data Set: Sample Superstore Dataset



Building a Line Chart - Discrete with DATEPART()


Using the Superstore data:

     Double-click Sales. This will put Sales on the Rows (alternatively drag Sales to Rows or to the y-axis).
     Double-click Order Date. This will put Order Date on the Columns (alternatively drag Order Date to Columns or to the x-axis).

Notice the Marks Card is set to Automatic in the dropdown box. Tableau will automatically create a line chart based on this data. You can select Line in the dropdown menu, but in this case it doesn't matter. Also notice that the Order Date pills on the Columns are blue pills. This line chart is visualizing a discrete date, using the DATEPART('year', [Order Date]) function.

     Double-click Order Date again to add Quarter of the Order Date to the Columns.
     Double-click Order Date again to add Month of the Order Date to the Columns.

You should now have a line chart similar to the image below.




Building a Line Chart - Continuous with DATETRUNC()


Using the Superstore data:

     Double-click Sales. This will put Sales on the Rows (alternatively drag Sales to Rows or to the y-axis).
     Double-click Order Date. This will put Order Date on the Columns (alternatively drag Order Date to Columns or to the x-axis).

Right-click on Order Date and select the second Month listed in the list. Year(Order Date) on the Columns should convert to Month(Order Date) and the pill color should change from blue to green.




This line chart is visualizing a continuous date, using the DATETRUNC('year', [Order Date]) function. You should now have a line chart similar to the image below.





Return to the TabCharts.com chart gallery