6 Replies Latest reply on Mar 29, 2016 12:08 PM by George smith

    Help with calculation between rows

    George smith

      New to tableau and I have some data from SQL sever that I put in the following format:

      About the data: Daily delivery delay code details, Totalcount  is total # of deliveries, Delaycode is # of delays for that delay code. Plant and Type are two dimensions. Basically I want to get a summary of daily (or weekly) ontime delivery % and delaycode % (to total delivery #) with comparison to previous day (or week) ,

       

      Date
      Plant
      Type
      MeaureName
      MeasureValue
      02/01/2016AADelayCode12
      02/01/2016AADelayCode212
      02/01/2016AADelayCode33
      02/01/2016AADelayCode440
      02/01/2016BBDelayCode12
      02/01/2016BADelayCode268
      02/01/2016BBDelayCode312
      02/01/2016BADelayCode112
      02/01/2016BADelayCode415
      02/01/2016BADelayCode520
      02/01/2016AATotalCount350
      02/01/2016ABTotalCount200
      02/01/2016ABDelaycode113
      02/01/2016ABDelayCode212
      02/01/2016ABDelayCode311
      02/01/2016ABDelayCode45
      02/01/2016BBTotalCount260
      02/01/2016BATotalCount400
      02/01/2016BADelayCode12
      02/01/2016BADelayCode23
      02/01/2016BADelayCode36
      02/01/2016BBTotalCount12
      02/01/2016BBDelayCode123
      02/03/2016

      For example, for 02/01/2016, plant A's ontime% is 1-(sum of delaycode1+delaycode2+delaycode3+delcaycode4)/ sum of Totalcount =1-(2+12+3+40+13+12+11+5)/(350+200),

      delaycode1%=(2+13)/(350+200). The end result should be like this, the last column can also be colored shape.

      02/01/201602/03/201602/04/201602/05/201602/06/201602/07/2016Change from Yesterday
      Ontime%95%100%85%89%95%97%2% ^
      Delay code110%5%1%1%0
      Delay code22%2%6%1%-1%
      Delay code33%2%1%2%1%
      delay code41%2%-2%

       

      Any help is appreciated!

      G.S.