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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Transform date into month and year format

Hi All,

 

i need to know, how Transform date into month and year format in excel query

 

rkrishnan_0-1601198173087.png

 

1 ACCEPTED SOLUTION

@Anonymous Do you want seperate column for Month and Year in your data, you can do this using below lines in power query

 

#"Inserted Month Name" = Table.AddColumn(#"Changed Type", "Month Name", each Date.MonthName([Date]), type text),
#"Inserted Year" = Table.AddColumn(#"Inserted Month Name", "Year", each Date.Year([Date]), Int64.Type)

 

Your output will be like below

negi007_0-1601207891540.png

 




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



Proud to be a Super User!


Follow me on linkedin

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi All, i need to know, how Transform date into month and year format in excel query i try this 1. Extract the Year into 1 column & Month Number into a second column, then Merge the columns together with a “-” as a separator then its come as Apr-2019 but remain as text format, while transform into pivot table as report, then the report comes in April-2019, August -2019, but i need April, May, June

@Anonymous Do you want seperate column for Month and Year in your data, you can do this using below lines in power query

 

#"Inserted Month Name" = Table.AddColumn(#"Changed Type", "Month Name", each Date.MonthName([Date]), type text),
#"Inserted Year" = Table.AddColumn(#"Inserted Month Name", "Year", each Date.Year([Date]), Int64.Type)

 

Your output will be like below

negi007_0-1601207891540.png

 




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



Proud to be a Super User!


Follow me on linkedin

@Anonymous 

Instead of creating those columns in Power Query, do it in the Data Model.

Go to your table, add a new column for Year Month Sorting:

 

YearMonthSort = YEAR([DATE]) * 100 + MONTH([DATE])

 


Add the Year Month column to use in visuals

 

Year Month = FORMAT([DATE],"MMM YYYY")

 

 

Now select the Year Month Column and got the Column Tools tab and sort by YearMonthSort column, Done

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 







 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.