Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pauldamen
New 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

1 ACCEPTED SOLUTION
tringuyenminh92
Memorable Member
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.

View solution in original post

1 REPLY 1
tringuyenminh92
Memorable Member
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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.