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
M_SBS_6
Helper V
Helper V

Year and Month to combine as Date

Hi, 

I have a Year column which is formated as 01/01/2023 so I have changed this to just show "yyyy" which is a Date Data type. 

 

I have another column which is Month. This shows January to December and is formatted as a text.

 

I need to combine both of these and create a Date column that would output as 01/01/2023

01/02/2023 etc

 

Any idea how to do this please? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@M_SBS_6  It looks like what you're trying to accomplish can be done in the query editor.

Split the Year column by delimiter

bchager6_0-1700140309098.png

Within the Transform tab, select the Split Column drop down. Select "/" as the delimiter, at each occurrence of the delimiter.

bchager6_0-1700149456321.png

 

Add a custom column with this code:

if [Month] = "January" then 1 else if [Month] = "February" then 2 else if [Month] = "March" then 3 else if [Month] = "April" then 4 else if [Month] = "May" then 5 else if [Month] = "June" then 6 else if [Month] = "July" then 7 else if [Month] = "August" then 8 else if [Month] = "September" then 9 else if [Month] = "October" then 10 else if [Month] = "November" then 11 else 12

bchager6_1-1700149522375.png

 

ctrl-click the following column headers to select them (in this order - important!): Custom, Year.2, Year.3

 

In the Transform tab, click Merge Columns

Choose a custom separator, and enter a forward slash (/)

bchager6_2-1700149788220.png

 

Rename the Merged column to Date (or whatever you'd like it named)

Change the new column's data type to Date

 

bchager6_3-1700149828658.png

 

Click Close & Apply on the Home tab

 

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@M_SBS_6  It looks like what you're trying to accomplish can be done in the query editor.

Split the Year column by delimiter

bchager6_0-1700140309098.png

Within the Transform tab, select the Split Column drop down. Select "/" as the delimiter, at each occurrence of the delimiter.

bchager6_0-1700149456321.png

 

Add a custom column with this code:

if [Month] = "January" then 1 else if [Month] = "February" then 2 else if [Month] = "March" then 3 else if [Month] = "April" then 4 else if [Month] = "May" then 5 else if [Month] = "June" then 6 else if [Month] = "July" then 7 else if [Month] = "August" then 8 else if [Month] = "September" then 9 else if [Month] = "October" then 10 else if [Month] = "November" then 11 else 12

bchager6_1-1700149522375.png

 

ctrl-click the following column headers to select them (in this order - important!): Custom, Year.2, Year.3

 

In the Transform tab, click Merge Columns

Choose a custom separator, and enter a forward slash (/)

bchager6_2-1700149788220.png

 

Rename the Merged column to Date (or whatever you'd like it named)

Change the new column's data type to Date

 

bchager6_3-1700149828658.png

 

Click Close & Apply on the Home tab

 

 

 

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.