A possible problem is that aggr() will not take notice of your sort order used in the pivot table, it will always use load order for your aggr() dimension values. When using aggr() in combination with a chart inter record function like above(), you need to consider this, i.e. you might need to align the load order of your dimensions field with the sort order you want.