Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

Year Month sort

Hello community,

In a chart I have a calculated date dimension to get the year and the month, like this:

year & '-' & month

but I'm unable to sort this dates, any ideas?

thanks in advance!

1 Solution

Accepted Solutions
Highlighted

Re: Year Month sort

use year * 100 + month, in this way you will have always numbers of 6 digits ex. 201401, 201402 ...

Sorting in this way is natural

Hope it helps

View solution in original post

5 Replies
Highlighted

Re: Year Month sort

use year * 100 + month, in this way you will have always numbers of 6 digits ex. 201401, 201402 ...

Sorting in this way is natural

Hope it helps

View solution in original post

Highlighted
Partner
Partner

Re: Year Month sort

Great! Worked like a charm, thanks Alessandro.

Specialist II
Specialist II

Re: Year Month sort

Try this in your sort expression

left(yearmonth,4)&Right(yearmonth,2)

Highlighted
Contributor
Contributor

Re: Year Month sort

Thank you!

This was quite helpful for me.

Highlighted
Partner
Partner

Re: Year Month sort

Hi,

month is a dual field. With a dual field you can show the string and sort by number.

If you are using monthname(Date) you will get Apr. 2019 for today, depending on your monthname settings and can sort by the numeric values.

If you want to show 2019 - 04 or 04 - 2019 you can load

dual(num(month(Date),'00' & '- ' & year (Date),year(Date)&num(month(Date),'00')) as Monthname

Show your field monthname and sort it by number if not by default.

Regards