Forum Discussion
Convert timestamp to Time in Power Query
- 4 years ago
Hi Anonymous
If you're not getting the output you want using M, I suggest just using "Split Column by Number of Characters" and then merge.
You can then merge like below:
Output will be:
You can then change the column format type to Time:
Hope this helps!
Theo 🙂
Hi Tom , can you kindly add you M script steps into mine please....
#"Inserted Text After Delimiter" = Table.AddColumn(dev_ema_crm_email_detail_View, "Field Force", each Text.AfterDelimiter([crm_salesforce], " "), type text),
#"Added Custom" = Table.AddColumn(#"Inserted Text After Delimiter", "MCCP Flag", each if[mcp_flag] = 0 then "No" else "Yes"),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "PadValue", each Text.PadStart( Text.From([email_sent_time_id]), 6, "0"))
in
#"Added Custom1"
Hi Anonymous ,
I'll give it a try 🙂
Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)
#"Inserted Text After Delimiter" = Table.AddColumn(dev_ema_crm_email_detail_View, "Field Force", each Text.AfterDelimiter([crm_salesforce], " "), type text),
#"Added Custom" = Table.AddColumn(#"Inserted Text After Delimiter", "MCCP Flag", each if[mcp_flag] = 0 then "No" else "Yes"),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"email_sent_day_date", type date}, {"email_sent_week_start_date", type date}, {"email_sent_time_id", type text}, {"crm_email_send_email_id", Int64.Type}}),
#"Pad Value" = Table.ReplaceValue(#"Changed Type",each [email_sent_time_id],each Text.PadStart ([email_sent_time_id], 6, "0"),Replacer.ReplaceValue,{"email_sent_time_id"}),
#"Replace Value" = Table.ReplaceValue(#"Pad Value",each [email_sent_time_id],each Time.FromText(Text.From([email_sent_time_id])),Replacer.ReplaceValue,{"email_sent_time_id"})
in
#"Replace Value"
Does this work? 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/