Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

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
Gysbert_Wassenaar

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

View solution in original post

9 Replies
ecolomer
Master II
Master II

Change your selection to Numeric Value

Gysbert_Wassenaar

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

View solution in original post

jonathandienst
Partner
Partner

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
MVP
MVP
Author

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

Kushal_Chawda

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.

kaushiknsolanki

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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
er_mohit
Master II
Master II

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

Hope it helps

Chanty4u
MVP
MVP
Author

yes...its not working.

jlongoria
Creator
Creator

"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

];