Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

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

This depends on your data.

Try sort it on load order.

chandashok
Contributor III

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

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_michaelid
Honored Contributor II

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

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

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

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