Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
alex-wb
Contributor III
Contributor III

Sorting months in a 12 month period

Hi all,

I have created an app that has a weekly and monthly breakdown which role over a current and previous 12 months period. My weekly data populates every time I enter a new week, whereas the monthly data populates every time I enter a new month. As  a result of this, my weeks will contain dates( based off of the current month we are in Nov-2021) , up until the 28th of November. However, my month is only up until the October 2021 since November isn't complete. The issue I am having is I can't sort my month properly by using max(MonthStartDate) because it puts November first which isn't correct in this case since the two Novembers in the graph below refer to 2020 and 2019. How can I sort the data?

I have tried sorting by using  Monthstart(max(FR_MonthStartDate),-1) but that doesn't work. Below is how I have formulated my RYTD period. 

Count({$<FR_MonthStartDate={">=$(=Monthstart(max(FR_MonthStartDate),-12))<=$(=Monthstart(max(FR_MonthStartDate),-1))"}>}Fault_Ref)

alexwb_0-1638293971122.png

Thanks for the help, much appreciated 🙂

 

2 Replies
Or
MVP
MVP

Perhaps consider using a dimension such as MonthName(Date) which results in e.g. "Nov 2021" rather than "Nov". Standard ascending sort will then get you the correct order and Nov 2021 will be separate from Nov 2020.

alex-wb
Contributor III
Contributor III
Author

Hi @Or , unfortunately I need to display it the way as seen above, so the solution isn't quite what I am looking for, but thanks for the reply.