Forum Discussion
pauldamen
9 years agoNew Member
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
- tringuyenminh92
Memorable Member
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.