cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MojoGene
Helper V
Helper V

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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors