top of page

Line Chart with a Dot at the End

Do you have a line chart comparing this year to last year data? Do you want a way to outline the most current month? One way to do this is to add a dot at the end of your line to visually call out the current month. Typically when we see dots at the end of a chart, the technique is called a sparkline with a dot. Sparklines identify trends and can be used in-line with text.

A great article on Sparklines is in the VizWiz site here.


In the below line graph, I am using Sample-Superstore Data. I am comparing the most current year (2019) to the previous year. The dot displays the last month of data which is in November.


This method is from this viz in Tableau Public by Justin Davis.


In order to create this graph, you will need to create a series of Calculated Fields below;


Current Month

[Order Date] >= DATEADD("month",-1, DATETRUNC("month", {MAX([Order Date])}))

AND

[Order Date] < DATETRUNC("month",{Max([Order Date])})


Current Year

[Order Date] >= DATEADD("month",0,DATETRUNC("year",{MAX([Order Date])}))

AND

[Order Date] < DATETRUNC("month",{Max([Order Date])})


Last Year

[Order Date] >= DATEADD("year",-1, DATETRUNC("year",{Max([Order Date])}))

AND

[Order Date] < DATETRUNC("year",{max([Order Date])})


Current Year or Last Year

IF [Current Year] then "Current Year"

ELSEIF [Last Year] then "Last Year"

END


Current Month Sales

If [Current Month]

then [Sales]

END


Create your line graph by placing Order Date on the Columns shelf. Right-click and select Month for the format.

Place Current Year or Last Year on the Color Marks Card.

I also added this pill to the Filters Card and Excluded any NULL values.




Drag Current Month Sales to the Rows shelf.

Ensure it is a Dual Axis by right-clicking on this pill.

You should now have a dot at the end of the most current year line.

You can proceed to remove the axis lines, any nulls and headers.




694 views0 comments
bottom of page