Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Nicolas
Frequent Visitor

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!

 

 

1 ACCEPTED SOLUTION

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

12 REPLIES 12
bhope
New Member

Hello, 

 

I am getting only January when using Format(Month([ColumnName])),"MMMM")

 

Format(Month([ColumnName])),"MMMM") = January

Format(Month([ColumnName])),"MMM") = Jan

Format(Month([ColumnName])),"MM") = 01

Format(Month([ColumnName])),"M") = 1

 

Columns data is stored as datetime format

not sure what is caysing this problem?

KHorseman
Community Champion
Community Champion

@bhope I assume this is for a second column and not a measure? You don't need the MONTH function. FORMAT(TableName[ColumnName], "MMMM") will return the month. Make sure you're using TableName[ColumnName] not simply [ColumnName].





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Seng
New Member

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

KHorseman
Community Champion
Community Champion

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

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks but it now returns only January...

Is there not another way of doing the same thing?

Thanks!

I am facing the same error as well. I am only getting January. Could anyone help?

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,

Anonymous
Not applicable

Hi @v-caliao-msft,

is there in a difference in terms of performance, with direct query in place?

Thanks in advance.

regards

Alex

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

 

FORMAT(TableName[Date], "MMMM")





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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

Not sure where I did wrong , I am getting month number 01 as Dec instead of Jan

Vinod_P_1-1683110094754.png

Please guide

same problem here.

Capture.PNG

 

 

 

 

 

 

Thanks to help!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.