The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Good morning.
I have a question regarding how to convert a text data that has a certain mask to a time field.
The data is provided by excel and in one of the fields I receive hours with the following format.
7h 30m
6h 50m
From this column I would like to extract another commune with time format.
Thank you
Solved! Go to Solution.
Thank you for the proposal, in the end I have chosen to separate the text into two parts, what is before the "h" and what is behind, with that I build a text with 00:00 format and from here I convert to time.
Best regards.
You can go to the table in your Power Query Editor (Transform Data), and add a custom column.
I managed to transform it to this:
Then you can change that data type to time.
Here is the formula:
let splitTime = Splitter.SplitTextByDelimiter("h", QuoteStyle.None)([Time]) in Text.Combine({Text.Middle([Time], 3, 1), Text.Combine(List.Transform(splitTime, each Text.Start(_, 2)), ":")})
I hope it works for you.
Thank you for the proposal, in the end I have chosen to separate the text into two parts, what is before the "h" and what is behind, with that I build a text with 00:00 format and from here I convert to time.
Best regards.