(question from the web)
I ma trying to transfomr an 8 digit text to a Date in Power Query. For instance, I want to transform in Power Query 02012021 to 02/01/2021 and format it
as a date?
Text |
|
Text |
Date |
02012021 |
|
02012021 |
02/01/2021 |
Code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Date = Table.AddColumn(Source, "Date", each
Date.FromText
(
Text.Format("#[day]/#[month]/#[year]",
[
day = Text.Start([Text],2),
month = Text.Middle([Text],2,2),
year = Text.End([Text],4)
],
"en-GB")
)
),
Type = Table.TransformColumnTypes(Date,{{"Date", type date}})
in
Type
Bookmarks