Forum Discussion

MaBla2's avatar
MaBla2
New Member
9 years ago
Solved

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.

  • 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

     

     

    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! :smileyhappy:

     

     

     

     

1 Reply

  • Sean's avatar
    Sean
    Community Champion

    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

     

     

    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! :smileyhappy: