Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting weekdays when comparing 7 days vs 7 days last year

Hi all,

I have a table chart comparing rolling 7 days this year with rolling 7 days last year. The problem is though that I need to compare weekday with weekday because sales are very different through the week.

For example, I am comparing Tuesday 09/07/2013 with Tuesday 10/07/2012.

The user can from a calendar pick a date and the rolling 7 objects start with showing sales for the selected date and 6 days prior to that date. That is all handled in the expressions

The problem is with the dimension for this chart. If have chosen weekday and I have problems with sorting the days in the correct order. I want the chosen weekday to be at the bottom and the prior days to go up.

In the example from above it should be:

Wed

Thur

Fri

Sat

Sun

Mon

Tue

Any help is very appreciated as I have struggled with this for quite some time now

6 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In the sort pane, select the Weekday field. Check "expression" for sort, and enter the datefield value as the sort expression.

-Rob

Not applicable
Author

Hi Rob,

Thanks, but I have tried this and it gives me this result (see below) if I select 10th May 2013. The first day, in this case Friday is always correct but after that the sorting won't work. Any other ideas?

Capture.PNG

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I don't recognize the language of your weekdays, so I'm having a hard time interpreting your results. What language is it? Can you upload a sample qvw?

-Rob

Not applicable
Author

Hi again,

Sorry, forgot about that.

The language is the QlikView-land language, Swedish

This will tell you what days they are:

DayNames ='Må;Ti;On;To;Fr;Lö;Sö';

The sort setting looks like this:

Sort.PNG

The expression for the rolling 7 days for current year looks like this:

Count( {$< Year=, Month=, Day=,Week=,Quarter=, Date={">=$(=Date(Max(Date-6)))<=$(=Date(Max(Date)))"}>} distinct Ordernr )

And for last year rolling 7 days:

Count( {$< Year=, Month=, Day=,Week=,Quarter=, Date={">=$(=Date(addmonths(Max(Date-5),-12)))<=$(=Date(addmonths(Max(Date+1),-12)))"}>} distinct Ordernr

Thanks

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Try

=min(Date)

for the sort expression.

-Rob

Not applicable
Author

Thanks Rob, but that didn't change the sort order.

Any more ideas?

Asa