Forum Discussion
Falcon
2 years agoHelper I
Merge and append timeline in multiple rows
Hello, My data table is similar as below MemberID ScheduleID StartDateTime StartTimeStamp StopDateTime StopTimeStamp 23 12 ...
- Anonymous2 years ago
Thank you parry2k for your prompt reply.
Hi Falcon ,
You can open Advanced Editor and follow these steps below:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nY9LCoAwDAWvUrouND+b6lWK97+GrW4SqYJCCIQML5PWInFMEak3ApLMmSGUDaDXWCiirlTPwQLsACl92FOLvAzuYxpWR1TuaVfcXG5y2wJ6u1fkJW0KOznwcqBkf2UxNAYiZ7dyNXaScfzqgKLPdv/j9gM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [MemberID = _t, ScheduleID = _t, StartDateTime = _t, StartTimeStamp = _t, StopDateTime = _t, StopTimeStamp = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"MemberID", Int64.Type}, {"ScheduleID", Int64.Type}, {"StartDateTime", type datetime}, {"StartTimeStamp", Int64.Type}, {"StopDateTime", type datetime}, {"StopTimeStamp", Int64.Type}}), #"Sorted Rows" = Table.Sort(#"Changed Type",{{"MemberID", Order.Ascending}, {"StartDateTime", Order.Ascending}}), #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1, Int64.Type), #"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each [Index]<=3), #"Grouped Rows" = Table.Group(#"Added Custom", {"MemberID", "ScheduleID", "Custom"}, {{"StartDateTime", each List.Min([StartDateTime]), type nullable datetime}, {"StopDateTime", each List.Max([StopDateTime]), type nullable datetime}}), #"Sorted Rows1" = Table.Sort(#"Grouped Rows",{{"StartDateTime", Order.Ascending}}), #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows1",{"Custom"}) in #"Removed Columns"Final output:
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Falcon
2 years agoHelper I
Can any one help me with this? really appreciate it