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: 
Anonymous
Not applicable

Fixing week 53 in a chart

Hello all,

I have a question regarding changing the positioning of week 53, as can be seen below:

Capture.PNG

I read through many earlier debates/questions regarding this, but I don't think the answerers really matched what I specifically was looking for, so I will try to ask a new question.

I have a chart showing weeks on the x axis, and sales on the the y axis.

Week 53 is positioned as the last week, even though it shoud be before week 1 (I know this is a common problem).

I was wondering if anyone has a solution to this, without doing it backend, changing the loading script, or anything in this regard.

I tried with using the match function under sort, as to match it to the Calendar date (as it I then thought it would match week 53 to january instead of what it is doing now).

Does anyone know if this can be solved either through a calculated dimension, or through filtering in the expression?

I am trying to solve it (if possible) without any backend work, but directly in the chart, as it is only for a specific chart I need it.

I look forward to hearing any possible answers.

Thank you!

Best,

Mathias Nielsen

1 Solution

Accepted Solutions
tresesco
MVP
MVP

May be sort expression something like:

If(Week=53, 0, Week)

Capture.PNG

View solution in original post

13 Replies
tresesco
MVP
MVP

May be sort expression something like:

If(Week=53, 0, Week)

Capture.PNG

rubenmarin

Hi Mathias, another option: if the weeks have a relation with a date field you can use the minimum date to sort weeks, the expression can be:

Min(Date)

or:

Min({1} Date)

rido1421
Creator III
Creator III

Hi Mathias

You could use the sort expression If(Week=53,1) under the sort tab,

For my own understanding why do you put week 53 before week1?

regards,

Ridhaa

Anonymous
Not applicable
Author

Hi Ridhaa,

The reason is that Week 53 includes both december and january data, as the week is "split" between the end of december and beginning of january. However, it includes jan. 1 - 3, and should therefore (in my dataset) come before week 1, but as I understand it, QlikView puts it last due to some internal mechanisms.

Anonymous
Not applicable
Author

Thank you, works!

Anonymous
Not applicable
Author

Hey Ruben,

Would it be possible to get a deeper explanation of this solution?

I don't think I fully understand it.

The dimension weeks is linked to the dimensions Calendar_Year, Calendar_Date (for example 2016-12-15), and Calendar_Month.

rubenmarin

Hi Mathias,

When 1 of january is friday, saturday or sunday the year starts at week 53, so 01/01/2016 will be on week 53 and 31/12/2016 will be on week 52.

So, sorted by week number 52 is before 53, but sorted by date 01/01/2016 is before 31/12/2016, and using date it will put the week 53 first, because it has the lower date.

Anonymous
Not applicable
Author

Ah okay, yeah this is actually what I myself was trying to do, namely use data to sort it, but I just could not/cannot figure out exactly how to write the expression for it.

I have these two dimensions for this:

Calendar_WeekNumber (Week numbers)

Calendar_Date (for example: 2016-03-01)

Would you do it under the "sorting" tab? and how specifically would you write this?

rubenmarin

Yes, I will try to sort by expression (like tresesco did) but using Calendar_Date in expression, so it will be:

Min(Calendar_Date)

or:

Min({1} Calendar_Date) // Ignores selections, used when the charts shows weeks out of selections (can be done using set analysis in dimensions and/or expressions)