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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Power Query Add New Column > Date.ToText as MM/YYYY

Hi I am trying to create a new column in power query, so that I can create an effective relationship between our opporunities and sales targets, by owner and mm/yyyy

 

Currently our Close Dates are in dd/mm/yyyy format, where as our sales targets are always 01/mm/yyyy

 

So I would like to try and create the relationship, just using mm/yyyy

 

Currently I am trying this, which it doesn't like 😞

Date.ToText((AllOpportunities[Opportunity Close Date]),[Format="MM/YYYY"])&[Opportunity Owner]&[Opportunity Record Type])

 

I got the following working OK:

Date.ToText(AllOpportunities[Opportunity Close Date])&[Opportunity Owner]&[Opportunity Record Type]) which gives me: DD/MM/YYYYSteve SteversonB2B

 

I would like this to be MM/YYYYSteve SteversonB2B

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Based on what I got, you need

Date.ToText([Date],"MM/yyyy")

 

Please keep the case same

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Rickmaurinus
Helper V
Helper V

Hey Cryonix, 

 

There's in total 17 format strings 'pieces' that I associate with the Date.ToText function. And the fun is, you can put all of those pieces together in your own way to create a string. For example, the following string returns "Sun December 31, 2023"

 

Date.ToText( 
  #date( 2023, 12, 31 ), 
  [Format="ddd MMMM d, yyyy"] 
)

 

And this one gives us back 'december':

Date.ToText( 
  #date( 2023, 12, 31 ), 
  [Format="MMMM", Culture="nl-NL"] 
)

 

I've put all of them together in a clear table, which you can find here: 

 

https://powerquery.how/date-totext/

 

Hope that helps!

 

Rick

--------------------------------------------------

@ me in replies or I'll lose your thread

 

Master Power Query M? -> https://powerquery.how

Read in-depth articles? -> BI Gorilla

Youtube Channel: BI Gorilla

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly.

Anonymous
Not applicable

worked like a charm, not sure why I didn't try that.  Thank you @amitchandak 

amitchandak
Super User
Super User

@Anonymous , Based on what I got, you need

Date.ToText([Date],"MM/yyyy")

 

Please keep the case same

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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