Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Converting numbers to month name

Hi,

Can some one help me in converting the numbers to month names?

I want to remove this number and just want to have the month names.

or is there any possibility to just change these numbers to month names.

Initially i used if statement to bring the month names. But i dont know how to replace the numbers with month names. Thank you.

Capture.PNG

25 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

This will also work (and much simpler)

Month('1/' & right([SPEND MONTH], 2) & '/2014') AS Month

because it doesn't matter in what year you place your month, as long as it's a month.

Not applicable
Author

Hi anand, should i do it expression tab or should i load it in the script?

Thank you

its_anandrjs

In load script is better but you can go for expression also but performance wise add another field in the load script.

Regards

Anand     

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

LOAD

*,

Date(Date#( '201411','YYYYMM' ), 'MMM' ) AS Month

Date(Date#( '201411','YYYYMM' ), 'YYYY MMM' ) AS YearMonth

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want to format this period into a monthname in the UI (straight table or so), see the example in attachment.

BTW uses the same expression as my previous post.

Peter

MarcoWedel

Month(Date#([SPEND MONTH],'YYYYMM'))

MK_QSL
MVP
MVP

Date(Date#(Period,'YYYYMM'),'MMM') as MonthName

tresesco
MVP
MVP

A word of caution: using Date(...,'MMM') to create month field might not be a good idea. While using date(), you get month names right for the field, but the internal number representation still remains a date. In that case, if you try to get back the month number using Num(), you won't. Here comes the advantage of Month() which returns a dual output (number in the backend and text in the front).

Date(Today(), 'MMM') =>Nov

Num(Date(Today(), 'MMM')) =>41947

Month(Today()) =>Nov

Num(Month(Today()) =>11

I always prefer using Month().

Not applicable
Author

Sorry guys nothing is working out here, i tried all the examples.

thanks for the reply.

Anonymous
Not applicable
Author

Try something like below,

Month(Date#(Left(Trim([SPEND MONTH]),6),'YYYYMM'))