Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting of month.year

Hello Everyone,

Can someone urgently help me in resolving this issue:

I have created my 'month.year' field in my script using the below line:

Load:

month(subfield([date], ' ' ,1)) &' '& Year(subfield([date], ' ' ,1)) as monthyear,

and it works perfectly.

However, when i create a bar chart with it, I do not manage to sort the date correctly.sort fail.PNG

I tried to sort it in all possible ways in the ''Chart Properties tab Sort'' but nothing works.

Thanks,

Hasvine

1 Solution

Accepted Solutions
rajkumarb
Creator II
Creator II

HI

Try using MonthName(date) As MonthYear,

instead of

month(subfield([date], ' ' ,1)) &' '& Year(subfield([date], ' ' ,1)) as monthyear,

in the Load then try sorting

View solution in original post

6 Replies
robert_mika
Master III
Master III

Try Dual function

How to use- Dual()

Not applicable
Author

Hi but unfortunately it is not working.I do not know if I am writing it correctly or not. Could you please give me an example?

rajkumarb
Creator II
Creator II

HI

Try using MonthName(date) As MonthYear,

instead of

month(subfield([date], ' ' ,1)) &' '& Year(subfield([date], ' ' ,1)) as monthyear,

in the Load then try sorting

Not applicable
Author

Hi

In script create resident  master calender table(month year,year,month etc...). order by Date.

EX:

Table:

load field 1,

         ..........

         Date,

from table;

load date,

year(date) as Year,

month(subfield([date], ' ' ,1)) &' '& Year(subfield([date], ' ' ,1)) as monthyear,

......

....

resident table

order by Date;



Regards,

Chennaiah

Not applicable
Author

Thanks Guys..It works now and I just finish my project.

QlikPankaj
Contributor
Contributor

The easy solution is to use the function with Month and Year field  and use it in the sorting expression.

 

=MakeDate(Year, Month)