4 Replies Latest reply: Jun 25, 2013 10:42 AM by David Ambrozie RSS

    Aggregation

    Danielle van Eeden

      Hi All,

       

      I'm trying to do a calculation in a chart expression, but I'm not sure that my data is calculating at the correct level so I think I may need to aggregate it somehow.

       

      My dataset is based around orders, and there can be multiple items per order, so my data is at Order-Item level.

      However, I need to calculate the average number of DaysToDeliver at Order level. I think Qlikview is automatically calculating this at Order-Item level

       

      for example;

       

       

      Order                  Item                DaysToDeliver                       

      1                          A                    50

      1                          B                    50

      1                          C                    50

      2                          R                    10

      2                          S                    10

      3                          Z                     3

       

      I would want the avg(DaysToDeliver) to give me a result of 21 (the average of 10, 50 and 3)

       

      However, it is actually giving me a result of 28.8333 (the average of 50, 50, 50, 10, 10, 3)

       

      I have experimented with the aggr function, but can't seem to get it to return any results so I'm not sure this is even the way I need to go!

       

      Any help much appreciated!