Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Thank you for all your response. It got solved.
Try sorting the Monthname dimension numerically in descending order; Properties Panel --> Sorting --> Sort Numerically --> Ascending
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
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.
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.
Hi Hari,
Use Sort by Expression and just give the DateColumn in that place that will solve your issue.
Thanks,
Lakshmikandh
Thank you for all your response. It got solved.
In Sort by Expression, You can have MonthStart field if you have created in Script and use that field for Sorting.
Please, mark the CORRECT/HELPFUL comments.