Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get month name from month number in Power BI?

I have Year number and Month Number in my data. How using DAX can I get the month name out of month number?

In SSRS its very easy. But how to achieve that using DAX?

enter image description here

enter image description here

like image 315
Serdia Avatar asked Mar 22 '17 23:03

Serdia


People also ask

How do you get the month name using DAX in power bi?

In Dax, if you column type is 'Date', you can create a calculated column to extract the month. In PQ ,if your column type is 'Date', you can use the option 'Date'->'Month'->'Name of Month' to create a custom column.

How do I display month by month in power bi?

Steps as per above illustrations: Fire up Power BI Desktop > edit query > Select your date table > select the date column > Add Column tab > Date button > Month > Month (again) > Select the Home tab > Closed and Apply.


1 Answers

You can use:

MonthName = FORMAT(DATE(1, [Num], 1), "MMM")

Result:

result

Nothing fancy, simply a reconstruction of a fake date from the month number provided, and reformat it with the FORMAT function.

Of course as an alternative you can go the old-fashioned way and write a SWITCH statement and hard-coded for the 12 months. It's up to you.

like image 71
Foxan Ng Avatar answered Oct 11 '22 02:10

Foxan Ng