Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

richard_chilvers
Contributor III

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

Tags (3)
1 Solution

Accepted Solutions
Employee
Employee

Re: Sorting by date in a chart

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

4 Replies
Not applicable

Re: Sorting by date in a chart

Hey Richard,

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

Thanks

AJ

Employee
Employee

Re: Sorting by date in a chart

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

Re: Sorting by date in a chart

Hi Henric

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

Richard

Employee
Employee

Re: Sorting by date in a chart

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

Community Browser