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: 
swetha54
Contributor III
Contributor III

Sorting week which is used in columns in pivot table in qlik sense

Hi All,

Can you please hlep me with the below issue i am facing in qlik sense.

My Week format is WW-MMM ex, 01-Jan

it is used in pivot table columns, while sorting the columns it is not sorting based on weekmonth combination instead there are options to sort alphabetically or number.

Need to write expression for sorting , can any one please help me with this.

1 Solution

Accepted Solutions
Nicole-Smith

This should work as a sort expression:

WildMatch(FieldName, '*Jan', '*Feb', '*Mar', '*Apr', '*May', '*Jun', '*Jul', '*Aug', '*Sep', '*Oct', '*Nov', '*Dec')

View solution in original post

6 Replies
Nicole-Smith

This should work as a sort expression:

WildMatch(FieldName, '*Jan', '*Feb', '*Mar', '*Apr', '*May', '*Jun', '*Jul', '*Aug', '*Sep', '*Oct', '*Nov', '*Dec')

dplr-rn
Partner - Master III
Partner - Master III

Apart from nicoles suggestion. Another option is to use dual on your Week field
e.g.
dual(your week month logic, week(CalDate))
Vegar
MVP
MVP

If you are creating weekMonth field from date you could create it as a dual like this and then you can sort the field numerically.

Dual(week(date)&'-'&month(date),
week(date)+(month(date)/100)) as Week

(I'm courious, why do you use week and month in your field, many weeks splits into two different months and you'in end up with weeks containing less than 7 days)
swetha54
Contributor III
Contributor III
Author

Thanks for your reply.

But this is not the case, no need to derive week from date.

swetha54
Contributor III
Contributor III
Author

Hi Nicole,

This experession is sorting by months but not weeks in the same month.

Can you please suggest how weeks also can be sorted.

swetha54
Contributor III
Contributor III
Author

Hi All,

My issue is resolved as i have used both sorted by expression and sorted by alphabetic.

Thank you all for your valuable responses.