Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
richard_chilvers
Specialist
Specialist

Sorting by date in a chart

I have a chart which selects the most recent 7 days of activity, then uses the WEEKDAY function of those 7 days to produce values in the chart:

I wish these to be displayed in date order. If today is Tuesday, the chart should (last) Wednesday through to today(Tuesday).

I cannot get the sort to work; I have tried using the activity date as a sort expression.

Apologies if a similar question has previously been answered.

Thanks & Regards

Labels (1)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

If you use

     Dual( WeekDay(Date), Date )

as dimension - either defined in the script or as calculated dimension, QlikView will display WeekDay but sort (numerically) according to date. Which is what you want.

HIC

View solution in original post

4 Replies
Not applicable

Hey Richard,

I used Weekday(Today()) in Expressions in Sort. Check out the attached file and see if it helps.

Thanks

AJ

hic
Former Employee
Former Employee

If you use

     Dual( WeekDay(Date), Date )

as dimension - either defined in the script or as calculated dimension, QlikView will display WeekDay but sort (numerically) according to date. Which is what you want.

HIC

richard_chilvers
Specialist
Specialist
Author

Hi Henric

Thanks for the helpful answer. It works ... and I now have to go and understand why

Richard

hic
Former Employee
Former Employee

The secret is in the Dual( ) function. Each field value has a text component and a numeric component. Read more on http://community.qlik.com/blogs/qlikviewdesignblog/2012/11/13/dual.

In your case, you display the textual part (weekday, the first parameter of the dual function) but you sort by the numeric value (the second parameter of dual).

HIC