2 Replies Latest reply: Mar 16, 2016 7:12 PM by Rick Worthy RSS

    Using Aggr in Expression over the Dimension

    Rick Worthy

      Hi All,

      I am having some difficulty in getting my aggr() function to work in one of my charts and am hoping this brilliant crew can assist.


      In short, I am measuring the quantity of incidents by divisions.  I am using a scatter chart with two dimensions being =ValueList('A','B') and =Division.  I then have two expressions:


      if(ValueList('A','B')='A', max(aggr(Count(Incidents),Division))/2, count(Incidents))


      if(ValueList('A','B')='A', 0, sum(Cost))


      The purpose of the aggr() function above is to find the Division with the most incidents, divide that number by 2 and then set the mid point of the chart at that location.  I am trying to create a starting 'mid-point' that should be the same for all Divisions showing on the chart.  This should also be a dynamic mid-point as filters are set (such at date range etc.).


      The issue appears to be that the aggr() function is doing the aggregation by dimension one Division at a time.  Since my chart dimension and the aggr () dimension are the same, my mid point is only aggregating with the one dimension available to it at a time.  The result is that every division has a different starting point that is set at half that divisions incident count.


      I have tried using  max(aggr(Count(TOTAL Incidents),Division))/2 , however, that simply gets me the Total of all Divisions divided by 2 not the Total count of the largest division divided by 2.


      The $Million dollar question is:  How do I get the aggr() function to look at ALL divisions inside the expression so that it can select the max total of the highest division?