Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
lone_wolf
Contributor
Contributor

Sort grouped bar chart based on previous month data

Dear experts,

I have a grouped bar chart here, where the sort condition(by expression in descending) is like: 

lone_wolf_1-1668272033028.png

where,

MonthYear are the bars

previous_MonthYear considers previous{month(Today()-1)}

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.

lone_wolf_0-1668271938168.png

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):

lone_wolf_3-1668273224576.png

 

lone_wolf_2-1668272965133.png

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.

Thank you in advance. 😊

Labels (1)
0 Replies