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
MojoGene
Post Patron
Post Patron

Power Query - can I convert a text or number to Month in Calendar?

Using Power Query, can I convert a text or number column to a Month in Calendar (date) column? The data look like this:

Convert Text Number to Month in Calendar.png

1 ACCEPTED SOLUTION

Hi @MojoGene 

As AlB said, if you have a [year] column, then use this formula

#date([year], [MonthNumber], 1)

 

Best Regards

Maggie

View solution in original post

4 REPLIES 4
AlB
Super User
Super User

Hi @MojoGene 

You can for instance add a custom column with this code for the column:

= #date(2020, [MonthNumber], 1)

to create the first day that month in 2020. change as required if you want another year or day

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

Cheers 

SU18_powerbi_badge

Thanks. That works for 2020. Can hard-coding the year be avoided?

Hi @MojoGene 

As AlB said, if you have a [year] column, then use this formula

#date([year], [MonthNumber], 1)

 

Best Regards

Maggie

Sure, as I said in the previous post, update the year or day with whatever is required

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

Cheers 

 

SU18_powerbi_badge

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
Top Kudoed Authors