MonthYear_max_BN contains the max month of each group.
This sorts the graph as below, sorted based on descending order of latest month if previous month data(eg: oct ) doesn't exist, else sorting is done based on previous month's data.
Now I want to display the data in descending order such that the bars are sorted like: (groups sorted by previous month eg: Oct)-->(groups sorted by current month eg: Nov)-->(groups sorted by previous-to-previous-to-previous month eg: Sep)-->(groups sorted by previous-to-previous-to-previous-to-previous month eg: Aug)-->So on..
I tried to do the grouping like this using aggr(), but it doesn't seem to work, except for the max(MonthYear):
I am unable to write a condition instead of max(MonthYear) in aggr() for eg: max(date(MonthYear-1,'MMM YYYY')), it doesn't seem to work.
I would really appreciate if the above two scenarios can be combined somehow.