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

Cleanest Way to get MonthName from MonthNumber

Morning ladies and gentleman,

Just a curious question, lets say i have this data set with 1 column

MonthNumber

1

2

3

4

 

What is a good way to get the Month Name from Month Number? 

i.e. Function(1) = Jan

 

I am aware of the workaround such as using a "fake year" to get them  but would like to see if there are other "cleaner" methods to do it.

i.e. Month(MakeDate(2015,MonthNumber)) 

 

Appreciate the assistance and insights. Thank you.

Labels (2)
2 Solutions

Accepted Solutions
Vegar
MVP
MVP

There are no function available that converts 1, 2, ..., 12 into Jan, Feb, ..., dec. You will have to go through makedate() or date#() to get there.

 

An workaround is to first define your Month as a Dual value, then its enough to use the digit to get the right value.

TmpMonth:

Load dual(Text, Value) as Month

Inline [

Text, Value

Jan., 1

Feb., 2

....

Dec., 12

];

 

Load 

ID,

Value,

Dim,

MonthNo as Month

From ...;

Drop table tmpMonth;

View solution in original post

kaanerisen
Creator III
Creator III

Month(Date#(MonthNumber,'M'))

View solution in original post

2 Replies
Vegar
MVP
MVP

There are no function available that converts 1, 2, ..., 12 into Jan, Feb, ..., dec. You will have to go through makedate() or date#() to get there.

 

An workaround is to first define your Month as a Dual value, then its enough to use the digit to get the right value.

TmpMonth:

Load dual(Text, Value) as Month

Inline [

Text, Value

Jan., 1

Feb., 2

....

Dec., 12

];

 

Load 

ID,

Value,

Dim,

MonthNo as Month

From ...;

Drop table tmpMonth;

kaanerisen
Creator III
Creator III

Month(Date#(MonthNumber,'M'))