Reply
Frequent Visitor
Posts: 6
Registered: ‎09-21-2016
Accepted Solution

FORMAT() returns Month Number

Hi

 

I'm trying to convert Month numbers (1,2,3...12) in text (January, February,...).

I tried :

 

 

=FORMAT(MONTH([MyColumn]), "mmmm")

Anyway i could return some text?

Thanks!

 

 


Accepted Solutions
Moderator
Posts: 1,386
Registered: ‎03-06-2016

Re: FORMAT() returns Month Number

Hi @Nicolas,

 

You can get the month name by using the DAX below.
MonthName = FORMAT(DATE(2016,Table1[MonthNumber],1),"MMMM")

 

OR

 

Month Name = SWITCH(Table1[MonthNumber],1,"January",2,"February",3,"March",4,"April",5,"May",6,"June",7,"July",8,"August",9,"September",10,"October",11,"November",12,"December")

 

Capture.PNG

 

Regards,

View solution in original post


All Replies
Super User
Posts: 1,183
Registered: ‎12-29-2015

Re: FORMAT() returns Month Number

=FORMAT(MONTH([MyColumn]), "MMMM")

Capitalization counts. https://msdn.microsoft.com/en-us/library/ee634398.aspx

Frequent Visitor
Posts: 6
Registered: ‎09-21-2016

Re: FORMAT() returns Month Number

Thanks but it now returns only January...

Is there not another way of doing the same thing?

Thanks!

Highlighted
Super User
Posts: 1,183
Registered: ‎12-29-2015

Re: FORMAT() returns Month Number

Oh yeah, the MONTH() argument shouldn't be there at all. FORMAT works on the entire date value.

 

FORMAT(TableName[Date], "MMMM")

Member
Posts: 119
Registered: ‎06-24-2015

Re: FORMAT() returns Month Number

Try FORMAT(TableName[Date], "MMM") for the three letter month name as well.

Moderator
Posts: 1,386
Registered: ‎03-06-2016

Re: FORMAT() returns Month Number

Hi @Nicolas,

 

You can get the month name by using the DAX below.
MonthName = FORMAT(DATE(2016,Table1[MonthNumber],1),"MMMM")

 

OR

 

Month Name = SWITCH(Table1[MonthNumber],1,"January",2,"February",3,"March",4,"April",5,"May",6,"June",7,"July",8,"August",9,"September",10,"October",11,"November",12,"December")

 

Capture.PNG

 

Regards,

New Member
Posts: 1
Registered: ‎10-10-2017

Re: FORMAT() returns Month Number

I created Year, Month and Day column and used MonthName = format(date('Calendar'[Year],'Calendar'[Month],'Calendar'[Day]), "mmmm") for the MonthName column.