Forum Discussion

pauldamen's avatar
pauldamen
New Member
9 years ago
Solved

Get date from full number

Hi,

 

I am pretty new to PowerBI. I have a colum with a year month date in it which looks like this: 201612 (december 2016). How can I get a recognized date from this?

 

Regards, Paul

  • Hi pauldamen,

    It could not be recognized as date type, you need to add one custom column based on this column.
    If this is int column (201612), you could use date method: new column= date(divide(yearmonthcolumn,100),mod(yearmonthcolumn,100),1) and choose this column data type is date type.
    If this is string column, you could: new column = date(value(left(yearmonthcolumn,4)),value(right(yearmonthcolumn,2)), 1)
    And choose this column data type to date type.

1 Reply

  • Hi pauldamen,

    It could not be recognized as date type, you need to add one custom column based on this column.
    If this is int column (201612), you could use date method: new column= date(divide(yearmonthcolumn,100),mod(yearmonthcolumn,100),1) and choose this column data type is date type.
    If this is string column, you could: new column = date(value(left(yearmonthcolumn,4)),value(right(yearmonthcolumn,2)), 1)
    And choose this column data type to date type.