Home » excel » excel – Power BI: Convert text (yyyymmdd) to date (dd/mm/yyyy)

excel – Power BI: Convert text (yyyymmdd) to date (dd/mm/yyyy)

Posted by: admin May 14, 2020 Leave a comment


I’m specifically trying to convert string in Column A : yyyymmdd to dd/mm/yyyy date format using Power Query Editor in Power BI. I can already perform this in Excel using the formula below:
Any ideas


How to&Answers:

Solution 1 :
Highlight the specific column , and on the Transform tab you can select Detect Data Type.
Solution 2 :
Try to create a new column named [dateFormatted] and apply the formula as follows:

dateFormatted = Date(Left([date],4),Right(left([date],6),2),right([date],2)

select the new column and change its type to date as follows:

enter image description here

[dateFormatted] will now be of type date, formatted as: dd Mmm yyyy


Just set the datatype to date.

M-Code although can be done through the GUI

    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}})
    #"Changed Type"


Solved: Highlight column in question, and on the Transform tab, select Detect Data Type. This switches it from String to Whole number. Then alter Data Type to Date. format provided is dd/mm/yyyy.
Hope someone else finds this useful