cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MaBla2 Frequent Visitor
Frequent Visitor

How to get a date column from two separate columns containing year and month?

Hi there,

 

In my table I have two separate columns for [Year] and [Month]. There is no information about the day or any other date / time information in the table. What do I have to do to get a new column consisting of year and month that is supported by the Time Intelligence feature of Power BI?

 

I assume it isn't too hard to solve my problem but I just didn't get it working.

1 ACCEPTED SOLUTION

Accepted Solutions
Sean Super Contributor
Super Contributor

Re: How to get a date column from two separate columns containing year and month?

@MaBla2 This will depend on your regional setting so of you are in the US ( or your standard date is MM-DD-YY)

 

MM-DD-YYYY Column = 'Table'[Month] & "-1-" & 'Table'[Year]

This will result in a Column of Data Type: Text => go to Modeling tab => change the Data Type to Date

 

As you can see this will work regardless of whether the Month Column is number, abbreviation or full month name

just don't forget to change the Date Type

 

2016-10-21 - Create a DATE Column.png

 

Now if you use DD-MM-YY in your region just change the order

 

DD-MM-YYYY Column = "1-" & 'Table'[Month] & "-" & 'Table'[Year]

This will also result in a Text Column which you need to Change in the Modeling Tab the same way.

 

Hope this helps! Smiley Happy

 

 

 

 

View solution in original post

1 REPLY 1
Sean Super Contributor
Super Contributor

Re: How to get a date column from two separate columns containing year and month?

@MaBla2 This will depend on your regional setting so of you are in the US ( or your standard date is MM-DD-YY)

 

MM-DD-YYYY Column = 'Table'[Month] & "-1-" & 'Table'[Year]

This will result in a Column of Data Type: Text => go to Modeling tab => change the Data Type to Date

 

As you can see this will work regardless of whether the Month Column is number, abbreviation or full month name

just don't forget to change the Date Type

 

2016-10-21 - Create a DATE Column.png

 

Now if you use DD-MM-YY in your region just change the order

 

DD-MM-YYYY Column = "1-" & 'Table'[Month] & "-" & 'Table'[Year]

This will also result in a Text Column which you need to Change in the Modeling Tab the same way.

 

Hope this helps! Smiley Happy

 

 

 

 

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)