Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

shanky1907
Contributor II

Calendar error

Hello,

I have an issue with the application as there is a cross table expression from that date field(Not a proper date field, just for time representation) is taken.

the format of date field is like this

201501

201502

201503...12

2016Q1

2016Q2...Q4

2017

2018

2019

On this filed, i need to sort a chart in ascending order of time. But i cant as it is not showing proper date stmap.

Please help finding any solution.

Thanks in advance.

5 Replies
Employee
Employee

Re: Calendar error

Text Order will handle proper sorting

shanky1907
Contributor II

Re: Calendar error

I tried Text Order Sorting. But its also not giving correct order.

Employee
Employee

Re: Calendar error

MVP
MVP

Re: Calendar error

1.png



a:

load

dual(field,

     if(len(field)=4, date(MakeDate(field)),

     if(isnum(field), date(MakeDate(Left(field,4), num(Right(field,2)))),

     MakeDate(Left(field,4), div(Right(field,1),3)+1

     )))) as field

inline [

field

2016Q1

2016Q2

2016Q3

2016Q4

2019

201501

201502

201503

201504

201505

201506

201507

201508

201509

201510

201511

201512

2017

2018

];

shanky1907
Contributor II

Re: Calendar error

Thanks for the explanation massimo.

I have tried 'Match' in the expression for sorting and got the right order for all the values as required.

Exp:

=Match (expr, vlaue1, value2,......value10)

Here,

Value1 will be given index# 1, value2 will be given index# 2 and so on.

So, by keeping this expression in ascending order had worked for me.

Community Browser