Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
h_prakash
Creator II
Creator II

Qlik Sense Bar Chart

Hi All,

I have created a bar chart in Qlik Sense with Year Month combination as Dimension (like Jan-2016, Feb-2016,......Nov-2020,Dec-2020...etc) and Expression is sum of sales for that combination.

The bar shows like this...

I want to sort the bars based on Month and Year like Jan-2016, Feb-2016, March,2016..etc. 

Please help me in this regard.

Thanks

Bar Chart.PNG

1 Solution

Accepted Solutions
h_prakash
Creator II
Creator II
Author

Thank you for all your response. It got solved.

View solution in original post

8 Replies
Anonymous
Not applicable

Try sorting the Monthname dimension numerically in descending order; Properties Panel --> Sorting --> Sort Numerically --> Ascending

Capture.PNG

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hello Hari

It looks like dimension you have created is a text only field. So i guess your MonthYear field is not created from date and it comes straight as it is in your source.

Normally date related dimensions are having dual value which is number and text behind it so you can then decide to sort it by text or by number.

I suggest to get it converted to dual and then sort numerically as Ugonna sugested.

To convert to dual go to script and do following thing:

If your source is already sorted the way you want it just load your field YearMonth with this formula - Convert your MonthYear to dual (text and autonumber):

     Load

          ...

          Dual(MonthYear , autonumber(MonthYear,'MonthYear') as MonthYear

     from

          YOUR_Source

     ;

There are other ways of getting the same thing working. It would be handy if you could provide qvf file and source for it so we could have a look and test

hth

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
jagan
Luminary Alumni
Luminary Alumni

Hi Hari,

How are you loading the month field?  Are you using Date() or MonthName() in script?  If it is string then load this field in script like below

LOAD
*,

Date(MonthStart(DateFieldName), 'MMM-YYYY') AS MonthYear

FROM DataSource;

Now use MonthYear field as dimension, if it is not sorted automatically then in Sort tab select Sort Numerically option.

Hope this helps you.

Regards,

Jagan.

berkarmagan
Partner - Creator
Partner - Creator

It depends on your script, if u create YearMonth as text i mean monthname or sth like that QS ll order it by alphabetic, u should convert it on date and after that just sort it on the right panel.

lakshmikandh
Specialist II
Specialist II

Hi Hari,

Use Sort by Expression and just give the DateColumn in that place that will solve your issue.

Thanks,

Lakshmikandh

h_prakash
Creator II
Creator II
Author

Thank you for all your response. It got solved.

shraddha_g
Partner - Master III
Partner - Master III

In Sort by Expression, You can have MonthStart field if you have created in Script and use that field for Sorting.

Anonymous
Not applicable

Please, mark the CORRECT/HELPFUL comments.