Forum Discussion
Convert 24 HR time
Hi,
I have a column of time data in 24 Hr time:
Time
625
844
1241
1556
Where 625 is 06:25 AM.
How can I convert this into a usable form for PowerBI?
Thank you,
The first formula I supplied is DAX. That is the one that starts with "Column =". You use that version after you have run your query and are out of the Query Editor window and in Power BI Desktop. You go to the Data tab (middle icon on the left) and go to "Modeling" and then "New Column". That is where you would use the FIRST formula.
The SECOND formula is when you are in the Query Editor window and go to "Add Column" in the ribbon and then New Column. You seem to be using the DAX query when you should be using the M query and using the M query when you should be using the DAX query.
14 Replies
- Greg_DecklerCommunity Champion
Column = CONCATENATE(CONCATENATE(LEFT([Time],LEN([Time])-2),":"),RIGHT([Time],2))
- AnonymousNot applicable
I received the following message: Expression error: The name 'CONCATENATE' wasn't recognized. Make sure it's spelled correctly.
- Greg_DecklerCommunity Champion
That would be because you were trying to enter a DAX formula into the Query Editor, which uses "M". Import your data and then in the Data tab, go to Modeling in the ribbon and "New Column". I'll see if I can post the equivalent M formula, but please note that you are posting to a forum on DAX Tips and Tricks, not Power Query "M" Tips and Tricks.
- diego_salinasAdvocate I
Maybe you want to use something like this:
Col = REPLACE([Hora],IF(LEN([Hora])=3,2,3),0,":")
:smileywink:
- diego_salinasAdvocate I
Maybe you want to use something shorter:
Col = REPLACE([Hora],IF(LEN([Hora])=3,2,3),0,":")
:smileywink: