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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
alopez802
New Member

How can I turn this column into a date type with a mm-yyyy format on power query?

I want to turn this column into a date type in power query but keep the month-year format. How can I achieve this on power query?

 

alopez802_0-1674773037019.png

 

6 REPLIES 6
ronrsnfld
Super User
Super User

You cannot. If you want the date displayed like that in the Power Query UI, you will have to set the data type to text and use a formula like: 

Table.TransformColumns(#"Previous Step",{"Column Name", each Date.ToText(_,"MM-yyyy"), type text})

 

Unlike Excel (or Power BI), Power Query does not have a separate formatting option for data.

Legend, looked everywhere for a solution to this, and it's exactly what I needed!


Gave kudos as well.

I tried implementing your idea. In the step prior I made PGP Match a text type and then in the following step I implemented your step but got the result seen in the picture below. What did I do wrong?

 

alopez802_1-1674837381021.png

 

 

alopez802_3-1674838701462.png

 

 

Maybe I am misunderstanding you.

If you already have the column PGP Match as text, there's no need to change it into anything. As I wrote, you cannot change it into a date and have it display as `MM-yyyy` in the Power Query editor.

 

My solution is a method of generating PGP Match from a column that already has a Date.

Okay that makes sense. I misunderstood you the first time. Thank you.

nickvanmaele
Advocate II
Advocate II

In Power Query, when you turn text string "11-2022" into a date, it will add a day which is the first date of the month. Without a day being specified, it is not a date. Hence, here is no real date which is called "11-2022". 

 

It seems that you are looking for a display solution. 

In Power Query, you could keep date 2022-11-01 (or 01/11/2022 or 11/01/2022 or whatever your local date format is). In Power BI or Excel, you can change the display format for that particular column to "MM-YYYY"

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors