2 Replies Latest reply on Dec 13, 2015 11:07 PM by abdul malik

    Calculate Interval Avg.

    abdul malik

      Hello,

      I have a requirement from the user to calculate Rolling Average for time intervals.

       

      Example: we are calculating Rolling averages for 3 months , 6 months, 9 months  using area charts for measure values and measure names.

      and the requirement is to compare this chart with average of sum of total 3 months or 6 months or 9 months.

       

      If the upper chart is showing rolling average for 3 months ,then the below chart  would show avg(of total  of 3 months values).

       

      is there any way to calculate time period sums and averages for rolling months .

       

      please help me on this.

       

      Thank you,

      Malik.

        • 1. Re: Calculate Interval Avg.
          Tableau kumar

          Hi,

           

          We can get the solution for your situation by using the Windows Calculations.

           

          1) Drag the the Date Field, then show the data for Year, Month combination

          EX: Year, Month

           

          2) create a calculated field,

           

          window_avg(sum([Sales], -1,0)

           

          3) Use the above calculated field on the view.

          or

           

          WINDOW_AVG(expression, [start, end])

          Returns the average of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

          For example, the view below shows quarterly sales. A window average within the Date partition returns the average sales across all dates.

           

          I am sharing my thoughts with out checking since i am answering from my office & don't have Tableau Environment here.

           

          Best Regards

          Tableau Kumar

          • 2. Re: Calculate Interval Avg.
            abdul malik

            Hello Kumar,

            Thanks for the reply , late response from my side due to i'm on vacation by that time.

             

            Regards,

            Malik.