Data Viz Done Right

June 21, 2016

Tableau Tip Tuesday: Using LOD Calcs for Year over Year Comparisons


For this week’s Tableau Tip Tuesday I show you how to use Level of Detail expressions to get the latest year and prior year and then compare then to create visual alerts.


  1. Hi Andy! thanks so much for this, it's great and just what I need. I'm trying to replicate this but when I get to the latest sales (in my case Revenue) "IF YEAR([Date])=[Latest Year ] Then [Revenue Ex Hedge] ELSE 0 END"
    It shows an error message of mixing aggregated and not aggregated arguments in the Year=Latest year and in the IF function.

    Any idea what am I doing wrong?

    Thanks so much!

    1. If your Revenue Ex Hedge field is an aggregate then the Year([Date]) and Latest Year need to be aggregates too. The easiest thing would be to make the revenue field a non-aggregate.