Skip to main content

Posts

Showing posts with the label Current Year and Last Year Measures Calculation in Tableau.

Current Year and Last Year Measures Calculation in Tableau.

Current Year and Last Year Measures Calculation in Tableau. We can achieve this in several ways but according to Tableau KB below are the steps in 2 different ways: Option 1: 1. Drag Year(Order Date) to Columns 2. Create a Calculation that returns sales for this year called  Current year sales:     if YEAR([Order Date])=YEAR(TODAY()) then [Sales] end 3. Create a Calculation that returns sales for last year called  Last year sales:    IF YEAR([Order Date])=YEAR( TODAY())-1 then ([Sales]) end 4. Create a look up calculation called  look up if current year  with following formula:    IF ATTR(YEAR([Order Date])=YEAR(TODAY())) then    LOOKUP(SUM([Sales]),-1) end 5. Drag  look up if current year  to filters and select Special -> Non-null values 6. Hide field labels for columns Option 2: 1. Create a Calculation that returns sales for this year called  Current year sales:     if YEAR([Order Date])=YEAR(TODAY...