2 Replies Latest reply on Feb 23, 2019 12:42 AM by KALPIT GOYAL

    How to calculate KPI based on year before?

    Shahirah Badrus

      Hi.

       

      I have a situation where I need to calculate the KPI based on year before. If the sales of the current year is bigger then the previous year, then the sales is increasing and vice versa. I know that Tableau already have the quick table calculation (difference from)  that already solve my problem, but the requirement want the difference being stated in shape (arrows up and down). Below the screenshot for my analysis.

      I've tried using my own calculation to differentiate the indicator based on difference between years but it's still doesn't work. Refer the image below, you can see that Machines have negative value for the difference in sales from the previous year, but still the shape indicate as 'Up'.

       

      This is my calculation for the indicator:

      IF ZN(SUM([Sales])) - LOOKUP(ZN(SUM([Sales])), -1)<0

      THEN "down"

       

       

      ELSE

       

       

      "up"

      END

       

      I've also attached my workbook in here. Thank you in advanced.