7 Replies Latest reply on Dec 1, 2016 4:40 AM by Norbert Maijoor

    Understanding aggregation issues

    D Sharpington



      I am having a problem with aggregation that makes me think I don't understand how Tableau's functions are working so I would really value an explanation!


      I have a data set with datetime, location id and volume fields - one row per location per hour


      Sdate                                  Cosit             Volume

      13/10/2006 09:00:00    000036000005    10

      13/10/2006 09:00:00    000036000006    1

      13/10/2006 10:00:00    000036000006    4


      I wanted to aggregate the volumes into specific periods of the day.  So I have created calculated fields such as 'total volume 4pm-7pm':

      IF DATEPART('hour', [Sdate]) >=16 AND  DATEPART('hour', [Sdate]) <19 THEN [Volume] END


      I also want to express those volumes as percentages so I've created calculated fields such as 'percent 4pm-7pm'

      ([total volume 4pm-7pm] / [Volume]) *100


      Now when I look at the outputs in data table the volumes have worked but the percentages haven't:



      If I change the 'percent' calculations from SUM to ATTR then the value each is 100.


      So I think I have misunderstood the logic of how the calculations work.


      Many thanks