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

How to get same month Name for all the years?

Hello,

I have a date field which is in '2018-08-31' format. I used the following expression in my script to get the Year and Month from it;

Year(Date) as Year,

date(Date, 'MMMM') as Month

But when I used list box for Year and Month, I am getting 12 months for 2016, separate 12 months for 2017 and separate 9 months for 2018. How to resolve this, to get the same months for all the years?

thanks

6 Replies
trdandamudi
Master II
Master II

Can you attach a sample file along the expected  output ?

vishsaggi
Champion III
Champion III

May be use Month(Date) AS Month

bhaveshp90
Creator III
Creator III
Author

I have used Month(Date) AS Month and I am getting same months for all years. But my month are like Jan, Feb, Mar....

But I want to have full month names

dplr-rn
Partner - Master III
Partner - Master III

try


SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';


Dual(      date(OrderDate, 'MMMM'),     Month(OrderDate))                     AS Month

Gopi_E
Creator II
Creator II

Hi Bhavesh,

If you want full months names you will get with the creation of the Inline table for that, like bellow

SNo Short_Month Full_Month

1       Jan                January

2       Feb                February

.        .                        .

.        .                        .

After creating you just form associate between existing short month table.

This is very helpful in different situations. with this, you can use short and full month names where you want.

Regards,

Gopi

vishsaggi
Champion III
Champion III

Try what Dilip suggested using 'MMMM' or you can also use Mapping table like

FullMonthName:

MAPPING LOAD * INLINE [

Month, MonthName

Jan, January

Feb, February

Mar, March

Apr, April

May, May

Jun, June

Jul, July

Aug, August

Sep, September

Oct, October

Nov, November

Dec, December

];

Load 

         ApplyMap('FullMonthName', Text(Month(DateField))) AS MonthNames

From yourtablename;