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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Dev-13
Helper I
Helper I

Date and Month Format

Hello,

 

I am looking to format the date in my calendar table as 2023M01 so in the example 2023 is the year plus M for month and 01 for the month. The syntax I have in my calendar is (100*year([date])+month([date])) This returns 202301 but I need to include the text M to give me the full requirement so 2023M01 I've tried adding in "M" in-between the year and month but it's not giving me the correct result. What syntax would work for this please?

2 ACCEPTED SOLUTIONS
BA_Pete
Super User
Super User

Hi @Dev-13 ,

 

Try this as a new custom column:

Text.Combine(
    {
        Text.From(Date.Year([date])),
        "M",
        Text.PadStart(Text.From(Date.Month([date])), "0", 2)
    }
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

Rickmaurinus
Helper V
Helper V

Hi Dev-13,

 

The easiest way to achieve this is by making use of the Date.ToText function. 

 Date.ToText( [Date], [Format = "yyyy'M'MM"] )

 The formatting strings allow you to turn a date (in the [Date] column) into your desired custom output. For the different possible output strings, take a look at : https://powerquery.how/date-totext/

 

There's an extensive list and image with example format strings. 

 

Regards,

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.

View solution in original post

3 REPLIES 3
Rickmaurinus
Helper V
Helper V

Hi Dev-13,

 

The easiest way to achieve this is by making use of the Date.ToText function. 

 Date.ToText( [Date], [Format = "yyyy'M'MM"] )

 The formatting strings allow you to turn a date (in the [Date] column) into your desired custom output. For the different possible output strings, take a look at : https://powerquery.how/date-totext/

 

There's an extensive list and image with example format strings. 

 

Regards,

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.

Thank you @Rickmaurinus This was a simple solution which worked well. 

BA_Pete
Super User
Super User

Hi @Dev-13 ,

 

Try this as a new custom column:

Text.Combine(
    {
        Text.From(Date.Year([date])),
        "M",
        Text.PadStart(Text.From(Date.Month([date])), "0", 2)
    }
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.