Search
  • Robert Breen

Tableau: Year Over Year Without Table Calculations

Updated: May 14







Step 1:

Build a line chart using [Date], and [Sales] to show 2020, and 2019 sales by month





Step 2:

Add an initial Year over year calculation using the Exclude function.


sum([Sales]) - sum({ EXCLUDE DATEPART('year', [Order Date]): sum(if DATEPART('year', [Order Date]) = 2019 then [Sales] end)})





Step 3:

Year over Year now shows for all marks. Adjust the calculation to only display a value for 2020 marks.


if year(max([Order Date])) = 2020 then

sum([Sales]) - sum({ EXCLUDE DATEPART('year', [Order Date]): sum(if DATEPART('year', [Order Date]) = 2019 then [Sales] end)})

END








99 views0 comments