Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort date with format MM/YYYY

Hello,

I have a date field built with the expression: mid(date(maydate),4,7) , the result has a format mm/yyyy. When i want to sort this field in my straight table it didn't work.

Someone can help me please.

Best Rgds.

9 Replies
googel84
Partner - Creator III
Partner - Creator III

Hi Attalah Abdelhamid, use the following expression to sort your value

date#('01/' & yourDateField,'DDMMYYYY')

Let me signal you also this post to which I replied

http://community.qlik.com/forums/t/37633.aspx

googel84
Partner - Creator III
Partner - Creator III

Sorry, I made a little mistake; the expression is

date#('01/' & yourDateField,'DD/MM/YYYY')

Not applicable
Author

thank you googel84 for your proposition, i tried your solution but it did not work

googel84
Partner - Creator III
Partner - Creator III

Please, provide me with more details, a qvw will be very helpful to understand your problem.

Bye

renjithpl
Specialist
Specialist





Try this...

Date(Date#(mid(date(maydate),4,7), 'M/YYYY'), 'MM/YYYY')

Regards



hector
Specialist
Specialist

Hi, you can try dual() maybe


dual(mid(date(maydate),4,7) ,maydate)



so you can sort by numeric value, because your text is going to be in MM/YYYY format, but the internal value will be a full date

rgds

PS. by the way the same result that you want can be with date(maydate,'MM/YYYY')

Not applicable
Author

Thank u very much mr Héctor,

I have change my initial formulas by Date(mydate,'MM/YYYY') instead of mid(date(mydate),4,7), and then i just made sort by numeric value and it worked.

Thank u Tout le monde:)

hector
Specialist
Specialist

Nice.

Remember flag the topic with the selected solution, to mark it as "Solved"

Rgds

googel84
Partner - Creator III
Partner - Creator III

Just to be clearer, the expression I suggested you was intended to be used to sort your listbox values, so you should have used it selecting the Expression option on tab Sort of List Box Properties.

Probably I hadn't been that clear.