cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BillyRaygun
Frequent Visitor

Add Column for Name of Month

Good Afternoon Community,

 

I monitor activity on a monthly basis. My Excel file does not have a column dedicated for month name. As I get more data each month, I will need to know the name of the month. Which is the better workflow, add this column in Excel, or in Power Query Editor?

 

Experimenting on my own, just to see what happens, I added a Custom Column in Power Query Editor:

 

D= Table.AddColumn(#"Changed Type", "Custom", each Date.MonthName) - results produce "Function" in each row.

 

I'm probably overcomplicating this, but I would think this should be a very simple column to add? Am I missing a step in my own workflow?
 
Best Regards,

 

 

 

 

4 REPLIES 4
BillyRaygun
Frequent Visitor

Thank you @TomMartens , @AlB 

 

I'll continue to push forward. I appreciate the support.

 

Best Regards,

hi @BillyRaygun - Another approach is to get the data into the model and then create a custom column in the data model

 
Full month name: Month Name = FORMAT('Calendar'[Date], "mmmm")
Short month name: Short Month Name = FORMAT('Calendar'[Date], "mmm")

Sumanth_23_0-1600976057095.png

 

Also you would need to sort the new column using "Month Number" to view the months in the correct order

Month Name.png

 

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

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

Proud to be a Super User!



AlB
Super User
Super User

Hi @BillyRaygun 

The part after the "each" is what goes into each row of  the new column. You are entering Date.MonthName, which is a function

You need something like

D= Table.AddColumn(#"Changed Type", "Custom", each Date.MonthName([Date]))

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

TomMartens
Super User
Super User

Hey @BillyRaygun ,

 

you have to pass a date into the function, the function has 2 parameters, the 2nd is optional.

Something like this:

Date.MonthName([columnname])

Or something like this:

Date.MonthName(DateTime.LocalNow())

You have to be aware that the Power BI Service is returning UTC time by default.

 

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.