4 Replies Latest reply on Dec 13, 2017 9:24 AM by Kiran Timmasarthy

    Challenge: how can I create a 3 week trend in a table (YTD)?

    Arnau Grau

      I need to create a table that shows the positive or negative trend for every production line in a multiple factory database. I should do so by comparing the YTD productivity value for a certain week to the YTD productivity value of 3 weeks back.


      My calculated fields are:

      Prod = [Prod Time]/[Week Time]  
      Prod YTD = RUNNING_SUM(sum([Prod Time]))/(RUNNING_SUM(sum([Week Time])))
      3 week trend = ZN(LOOKUP(RUNNING_SUM(sum([Prod Time]))/(RUNNING_SUM(sum([Week Time]))),[WeekSelect])) - ZN(LOOKUP(RUNNING_SUM(sum([Prod Time]))/(RUNNING_SUM(sum([Week Time]))),[WeekSelect]-3))

      I use a "WeekSelect" parameter that takes the values of the specific Week Number.

      My calculations only show 0% on the table for now and I have tried many alternatives (also without the parameter, calculating by cell, week, etc) but haven't succeeded.

      Please, see the attached sample file.

      I am using Tableau Desktop 9.1

      Any help will be greatly appreciated! Thanks!