2 Replies Latest reply on Sep 7, 2012 1:43 PM by brett.woods

    How to average over a specified time interval?

      I am trying to average values within a custom time interval that I can change. For example I want to obtain average values in 30 minute chunks.  So if my data set is logged every 3 minutes over a period of 30 days I want to take the values within each 30 minute window and average them and plot that as a single data point, then repeat over the entire 30 day period. 

        • 1. Re: How to average over a specified time interval?
          Wilson Po

          Hi Brett,


          It sounds like you need to a date aggregation level that is not native to the Tableau's time hierarchy, so that you can roll up your data in 30min intervals.  Don't worry, this isn't difficult; just write a calculated field with the following formula:


          DATETIME(INT(FLOAT([Date Time])/(30/1440))*(30/1440))


          The obvious note is that you should your own date time field in placed of the [Date Time]


          When you choose to display this as discrete or continuous exact date, it should only give you data points at the start and middle of each hour.  Likewise if there's 6 data points that occur between 1:00AM-1:30AM, these 6 data points will be summarized under the 1:00AM data point for the new time field.  Thus taking the avg(Values) on this new time field should effectively give your the avg over 30min intervals.


          Hope this helps!



          • 2. Re: How to average over a specified time interval?

            Perfect! Exactly what I was looking for.


            Thanks for the quick reply.