Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Hope you are able to help me out on this.
In a line chart I am showing production per week (format WeekOfYear) for the last 18 weeks and the corresponding weeks the year before. So I have en expression for each of those.
Last 18 weeks:
sum({1<
MyDate={'>=$(=WeekStart(Today(),-18))<=$(=WeekEnd(Today(),-1))'}
,DateType={'ProductionDate'}
>}M_Units)
Previous year:
sum({1<
MyDate= {'>=$(=WeekStart(addyears(Today(),-1),-18))<=$(=WeekEnd(addyears(Today(),-1),-1))'}
,DateType={'ProductionDate'}
>}M_Units)
I'm using a canonical calendar (inspired by this post: https://community.qlik.com/t5/Qlik-Design-Blog/Canonical-Date/ba-p/1463578) and DateType is a field from my DateBridge table. As my dimension I am using a week-field from my canonical calendar.
My problem is: How do I sort my dimension correctly? As default it gets sorted numerically, which puts week 51 and 52 in the end when their actually should be first.
I want it to be sorted like shown in the mock-up below.
Unfortunately I'm not able to post my data or application.
Thank you in advance.
How about adding Sort by expression as follows with Ascending order
Week(MyDate)
Thank you for you response, but unfortunately your suggestion gives me the following result:
If Week(MyDate) returns correct it should work as expected.
BTW, Can you simply put same dimension in Sort by expression and try with some options?
I just remembered, that I'm using a canonical calendar inspired by this:
https://community.qlik.com/t5/Qlik-Design-Blog/Canonical-Date/ba-p/1463578
(I have updated my original post with this info now)
And I guess that affects how sorting works but I'm not quite sure how.