Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
Chanty4u
Esteemed Contributor III

RE:Bar Sort order

Hi all,

I have some issue in bar chart where am unable to get sortout the  yearmonth values in order.

Dimension:YearMonth.

REQ:in chart need to show values as

2015 oct

2015 nov

2015dec

2016jan

2016feb     chk below my chart and sort tab;

2016mar

sort1.PNG

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: RE:Bar Sort order

Create your Month_Year field as a date in the script: Date(MonthStart(MyDate),'YYYY-MMM') as Month_Year. Then sort it by Numeric Value in the chart.


talk is cheap, supply exceeds demand
9 Replies
ecolomer
Honored Contributor II

Re: RE:Bar Sort order

Change your selection to Numeric Value

MVP & Luminary
MVP & Luminary

Re: RE:Bar Sort order

Create your Month_Year field as a date in the script: Date(MonthStart(MyDate),'YYYY-MMM') as Month_Year. Then sort it by Numeric Value in the chart.


talk is cheap, supply exceeds demand
MVP
MVP

Re: RE:Bar Sort order

Create your YearMonth field as a proper datetime field and you can sort it numerically.

If you get the YearMonth as a text field from your source, then convert during the load:

     LOAD ...

          Date#(YearMonth , 'YYYY-MMM') as YearMonth,

          ...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Chanty4u
Esteemed Contributor III

Re: RE:Bar Sort order

if i change to numeric...also its not givng

Re: RE:Bar Sort order

Your monthyear field is in string format. Make it in Number format like below

date(date#(MonthYear,'YYYY-MMM'),'YYYY-MMM') as MonthYear

Now go to Sort tab and sort it by Numerical values.

Re: RE:Bar Sort order

Hi,

It seems that the values (YearMonth) is a string. You must use the date format to get the values in numbers and then they will be sorted as per your requirement.

Use below function to get the Year Month.

Date(Date,'YYYY-MMM') as YearMonth

Regards,

Kaushik Solanki

er_mohit
Honored Contributor II

Re: RE:Bar Sort order

Hi, Have you tried to checked Load Order Original and uncheck from all.

Hope it helps

Chanty4u
Esteemed Contributor III

Re: RE:Bar Sort order

yes...its not working.

jlongoria
New Contributor III

Re: RE:Bar Sort order

"The first thing you should be aware of is that there are two different functions: Date#() and Date(). The first is anInterpretation function and the second is a Formatting function". That is from this link...good stuff: The Date Function

This is what a possible solution for you would look like.

LOAD

  Date#(MyTextDate, 'YYYY-MMM') as MyDate,

  MyValue

;

LOAD * INLINE [

    MyTextDate, MyValue

    2015-Dec, 63

    2015-Nov, 52

    2015-Oct, 42

    2015-Sep, 79

    2016-Feb, 31

    2016-Jan, 34

    2016-Mar, 36

];