1 Reply Latest reply on Feb 6, 2013 3:28 AM by Jim Wahl

    Dynamic average vs rolling timeframe

    Xavier P

      Hello Tableau fans and Zen Masters!

       

      I update dashboards monthly and have calculations around static averages.  These evolve monthly as they are themselves calculated over a 12 month rolling timeframe.

       

      Was wondering if anyone could help to set a dynamic average which would update itself each month with data from the last 12 months.

       

      [Measure] is called page views and Dimension is called [Month] - sounds easy but cannot figure it out.

        • 1. Re: Dynamic average vs rolling timeframe
          Jim Wahl

          You might have tried this already, but what about:

          IF LAST()==0 THEN

              WINDOW_AVG(SUM([Sales]), IIF(LAST()==0, -11, 0), 0)

          END

           

          This averages the current plus previous 11 values (months); for the last value (month) only. In this case Year and Month need to be on the sheet and you need to edit the table calculation to compute over Date at the level of Month of date.

           

          See attached.