3 Replies Latest reply on Apr 3, 2018 1:47 PM by Eric Hammond

    Line graph with running totals over time and missing dates

    Nathan Brower

      Given a data source with a date field and a numeric value field, I want to use tableau's table calculations to make a line graph with a running total. Specifically, I have truncated my date field to weekly and am graphing a 4-week running total over a year.  Tableau seems to do this by using the current period value and then grabbing the prior three data points rather than the prior three weeks.

       

       

      The issue is that I do not have observations for every week, so when there is a missing week, Tableau looks back more than three weeks to find that third prior data point.  Instead of skipping missing observations.  For example (notice that there is no observation for the week of 1/15/2018):

       

       

      Date (Week)Sales VolumeTableau's 4 week running totalActual 4 week running total that I want
      1/8/20181--
      1/22/20182--
      1/29/20183--
      2/5/20184109

      The table calculation in my line graph looks like this:

      WINDOW_SUM(SUM([Sales Volume]), -3, 0)

       

       

      Any ideas?

       

      Thank you!