Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

colinodonnel
Contributor

left align dates

Hello all,

Hopefully there is a solution to this that I have overlooked.

I note that:

A: Qlik Sense automatically left aligns Text and right aligns Dates and Numbers.

B: The reason why Dates are right aligned is because of the Dual function which stores Dates as a text string to be displayed and a number for processing and sorting the order.

I have been able to convert a date to a text so that it Left Aligns using the following function in the script:

Text (Date("Date",'MMMM'))  as "Month",


This means that visually, the filter planes all line up as they should as follows:

Month.png

The problem now is the order is now out of sync  as the text is now sorted alphabetically.

How can I arrange the order of the text?

Perhaps add a preceding number or some other character to the text? This preceding number/character would need to remain invisible.

I have tried playing with the Dual function, but when I apply a number to the text, it gets right aligned again.

Many thanks,

Colin

4 Replies
YoussefBelloum
Esteemed Contributor

Re: left align dates

Hi,

would you be able to attach the QVF ?

otherwise, try this on the sorting:

=min(Date)  ==> ascending


or


=Max(Date) ==> descending

ChennaiahNallani
Contributor III

Re: left align dates

go with custom sort with expression.

=match (Month, 'Jan', 'Feb', '....)

Highlighted
colinodonnel
Contributor

Re: left align dates

Hi Youssef,

Thank you for the reply.

Your reference to Sort directed me to the Sorting Area.

I edited the Filter Pane.

When to Sorting and changed it to "Sort Numerically".

It has now put the Text in the correct order.

I don't understand why this has worked but it has.

So in essence, it is now solved and this is now a solution

Best Regards,

Colin

colinodonnel
Contributor

Re: left align dates

Hi Chennaiah,

Yes I have just tried your solution and it works as well.

The full expression is:

=match(Month, 'January', 'February','March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')

Thank you,

Colin