Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I re-order the x axis of a chart?

I have a chart where the x axis is weekdays, and I want to put it in order ie. Mon. Tues. Wed.  Right now I only know how to sort by alphabetical (A->Z), or y axis.  Is there an expression that will let me change it so it is chronological?

4 Replies
Anonymous
Not applicable
Author

This depends on your data.

Try sort it on load order.

Anonymous
Not applicable
Author

Hi,

          i think this attachment file will be helpful for your doubt.

          This is the one of the way to sort the item / days as we need..

Regards,

Jason_Michaelides
Luminary Alumni
Luminary Alumni

I'm not able to open Chandashok's qvw on my iPad so I don't know if this solution's already been presented...

To expand on Dennis's suggestion, one way to sort string values in a desired order is to preload the order in the script.  QlikView stores each field in its own memory table and distinct values are concenated as they are loaded. In this example, you should load the day of the week in an inlne table at the top of your script then drop it at the end. Something like:

Weekdays:

LOAD * INLINE [

Weekday

Mon

Tues

Wed

Thurs

Fri

Sat

Sun

];

Data:

LOAD

  Field1,

  Field2,

  Field3,

.

.

.

  Weekday,

.

.

.

FROM....;

DROP TABLE Weekdays;

Now, in your chart on the sort tab, promote Weekday to the top and check the box to sort by Load Order.

NOTE: The field name "Weekday" in the inline table must be EXACTLY the same as the field name from the main data load.

Hope this helps,

Jason

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Create a weekday field using dual function like

LOAD

          Dual(WeekDayString, WeekDayNum) AS WeekDay

INLINE [

    WeekDayNum, WeekDayString

    1, Mon

    2, Tue

    3, Wed

    4, Thur

    5, Fri

    6, Sat

    7, Sun

];

Use sort by Numeric value as ascending or descending whatever way you want.It will order the weekday day field based on the WeekDayNum order.

This should be before the other table with the week day field load.

Hope it helps

Celambarasan