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
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,

 

 

 

 

5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

Good afternoon I was very useful your solution, however, when I put the month in the table it organizes it in alphabetical order, and when I try to sort it by month number it does not appear as in its images.

I appreciate very much if you can help 🙂 me

Catalina2023_0-1683845987233.png

Catalina2023_1-1683846084652.png

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
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.

Top Solution Authors