6 Replies Latest reply: Oct 30, 2011 8:41 PM by Marko Banjanin RSS

    Return text from aggr() function

      Hello,

       

      A little help will be much appreciated.

       

      The following is my data set:

       

      org,     store nr,     store name,     wk,     sales

      a,         1,               a1,               1,     100

      a,         2,               a2,               1,     110

      a,         3,               a3,               1,     120

      a,         4,               a4,               1,     125

      b,         1,               a1,               1,     99

      b,         2,               a2,               1,     10

      b,         3,               a3,               1,     130

      b,         4,               a4,               1,     109

      a,         1,               a1,               2,     126

      a,         2,               a2,               2,     127

      a,         3,               a3,               2,     135

      a,         4,               a4,               2,     10

      b,         1,               a1,               2,     190

      b,         2,               a2,               2,     179

      b,         3,               a3,               2,     110

      b,         4,               a4,               2,     111

       

      I am using

      =max(aggr(sum(sales),[store nr],org,wk)

      to derived the highest sale -- 190 in this case

       

      I can't seem to get the formual working to return the actual name of the store (a1 in this case) instead of the sales number. I tried maxstring() but no luck.

       

      Thanks!