Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lthurman
Partner - Contributor III
Partner - Contributor III

Formatting a date using the Expression Editor

Hello Qlik Sense Community,

I need to convert a date variable from this format 201701 to Jan 2017. I tried using Date and Date#, but instead of getting the short month and year, I only get the year. Our variable name is BillingDate and I use it like this:

Date(Date#(BillingDate, 'YYYYMM'), 'MMM YYYY')

I've also tried using MM as part of the output format, but I still only get the year. Any ideas as to where I may be going wrong?

Thanks

Labels (1)
12 Replies
lthurman
Partner - Contributor III
Partner - Contributor III
Author

Ok, so after adding the aliases to my load script, I tried this:

=Date(Date#(Num#(Text), 'YYYYMM'), 'MM YYYY')

and

=Date(Date#(Num), 'YYYYMM'), 'MM YYYY')

Same result.

Thanks for helping with this, by the way.

sunny_talwar

I was wondering if you can share a list box object for the two new fields that you created on my request....

lthurman
Partner - Contributor III
Partner - Contributor III
Author

Sorry, I forgot to follow up, but we finally figured it out. It seems that our original formula was trying to create a date from a string. We should have been trying to create a date from a number. The correct formula to create our MMM/YYYY date is:

=date(makedate(num(left(BillDate,4)),num(right(BillDate,2))),'MMM YYYY') where Billdate is a sring of the format, YYYY/MM.

Thanks for all your help.