Forum Discussion
FORMAT() returns Month Number
- 9 years ago
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")
Regards,
=FORMAT(MONTH([MyColumn]), "MMMM")
Capitalization counts. https://msdn.microsoft.com/en-us/library/ee634398.aspx
- Nicolas9 years agoFrequent Visitor
Thanks but it now returns only January...
Is there not another way of doing the same thing?
Thanks!
- v-caliao-msft9 years agoMicrosoft Employee
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")
Regards,
- Anonymous7 years agoNot applicable
Hi v-caliao-msft,
is there in a difference in terms of performance, with direct query in place?
Thanks in advance.
regards
Alex
- Anonymous9 years agoNot applicable
Oh yeah, the MONTH() argument shouldn't be there at all. FORMAT works on the entire date value.
FORMAT(TableName[Date], "MMMM")
- trebgatte9 years agoMost Valuable Professional
Try FORMAT(TableName[Date], "MMM") for the three letter month name as well.
- Qwer12346 years agoRegular Visitor
I am facing the same error as well. I am only getting January. Could anyone help?