Forum Discussion
Value and Identifier in 2 Columns
So it looks like alot of people had different approaches and i'm still trying to figure out the grouping.
I grouped the data and unpivoted the table. I plan to use the data/time started as the unique indentifier column.
Since the material used falls on a line under the material type used, I need to get these on the same line? The group by function is what is confusing me.
| Printer | Started | Completed | Total Job Time | Total Print Time | Status | Attribute | Value |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 1 | VeroPureWhite |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 1 Usage | 56.992 |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 2 | Agilus30Clear |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 2 Usage | 33.619 |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 3 | TissueMatrix |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 3 Usage | 18.039 |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 4 | VeroMagenta-V |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 4 Usage | 24.561 |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 5 | BoneMatrix |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 5 Usage | 23.18 |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 6 | GelMatrix |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Model Material 6 Usage | 26.864 |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Support Material 1 | SUP706 |
| 00E0F434FC6C | 9/18/20 15:06 | 9/18/20 19:14 | 0.04:08:31 | 0.04:04:32 | Finish | Support Material 1 Usage | 202.76 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 1 | VeroMagenta |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 1 Usage | 0 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 2 | VeroPureWhite |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 2 Usage | 28.605 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 3 | Agilus30Clear |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 3 Usage | 22.325 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 4 | TissueMatrix |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 4 Usage | 9.522 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 5 | BoneMatrix |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 5 Usage | 9.956 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 6 | GelMatrix |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Model Material 6 Usage | 13.025 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Support Material 1 | SUP706 |
| 00E0F434FC6C | 9/16/20 7:18 | 9/16/20 9:26 | 0.02:08:29 | 0.01:57:46 | Finish | Support Material 1 Usage | 95.823 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 1 | VeroPureWhite |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 1 Usage | 52.155 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 2 | Agilus30Clear |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 2 Usage | 34.051 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 3 | TissueMatrix |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 3 Usage | 15.961 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 4 | VeroMagenta-V |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 4 Usage | 17.285 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 5 | BoneMatrix |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 5 Usage | 18.246 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 6 | GelMatrix |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Model Material 6 Usage | 23.779 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Support Material 1 | SUP706 |
| 00E0F434FC6C | 9/11/20 7:52 | 9/11/20 11:29 | 0.03:37:48 | 0.03:32:18 | Finish | Support Material 1 Usage | 169.415 |
- Jimmy8015 years agoCommunity Champion
Hello Anonymous
I don't know what this dataset has now to do with the original request. Seems like you didn't show us the reald dataset in your initinal post. If you can show us how your orignal dataset is looking like, and what exactly you need.
Here my best guess 🙂
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("vZdNa8MwDIb/Sul5c235I7ZvW1l3Kgy6dofSQ2BmC4R2JC3s58+hJc4YAY+qukXOx5M3UqTX2+2U8ye+UFIt5mY+vZu6mbAz4BOhPTfD2HmhYswZV55bL0UfKC8hBotqX7Wf8WB5eA/1ZFkeQ1OV9aS7cBOaw8upCW+f1TFMd3cU2Mm6LT9CPKENcw5oqN25h4+qPrWSz+tQNkTYXqyUzAhHQ5Vx6bVq21OIS031TUTttQrLuCTSqi5VvIzo/bG83xBhe7GgmDaChqrj0uNhT5pWnZRKJiwNtHvKc6gpdZqk0zBr1AjVdJTCxw+RQufBnDHQMcGdA+F14ZXJaMGX4iVB9jI5BQ4yhwwuNKXSMsM1BVNmDhhcaBIKTAKJUJU3XHCZvU7HNIxZBlRkVqvFJQ5EOm0okDltFheYPIKMN9+mYFenr69Dc/zdZlfrl4Lf5qP+5aVMamZBjlDFmaphEArRk6SXkWT7AM7vd62dR6YmNw9M6LGE4kJzzTwyNXl5xbges3y40EwrjwxNf6lmbtTc4kJzjTwyNUktGFia+s2aLcjI4eYM1FgjxIXmjBdk4nCzUhRje9Arof8fMOjAlE7jmBKxbnc/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Printer = _t, Started = _t, Completed = _t, #"Total Job Time" = _t, #"Total Print Time" = _t, Status = _t, Attribute = _t, Value = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Printer", type text}, {"Started", type text}, {"Completed", type text}, {"Total Job Time", type duration}, {"Total Print Time", type duration}, {"Status", type text}, {"Attribute", type text}, {"Value", type text}}), MaterialType = {"Model Material 1", "Model Material 2","Model Material 3", "Model Material 4", "Model Material 5", "Model Material 6", "Support Material 1"}, #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Attribute]), "Attribute", "Value"), AddRecordList = Table.AddColumn ( #"Pivoted Column", "RecordList", (rec)=> List.Transform(MaterialType, (trans)=> Table.Column(Record.ToTable(Record.SelectFields(rec, List.Select(Table.ColumnNames(#"Pivoted Column"), (sel)=> Text.Start(sel,Text.Length(trans))= trans))), "Value")) ), DeleteColumns = Table.RemoveColumns ( AddRecordList, List.Select(Table.ColumnNames(AddRecordList),(sel)=> List.AnyTrue(List.Transform(MaterialType, (trans)=> Text.Start(sel,Text.Length(trans))= trans))) ), #"Expanded RecordList" = Table.ExpandListColumn(DeleteColumns, "RecordList"), #"Extracted Values" = Table.TransformColumns(#"Expanded RecordList", {"RecordList", each Text.Combine(List.Transform(_, Text.From), "&&"), type text}), #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "RecordList", Splitter.SplitTextByDelimiter("&&", QuoteStyle.Csv), {"RecordList.1", "RecordList.2"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"RecordList.1", type text}, {"RecordList.2", Int64.Type}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"RecordList.1", "Material"}, {"RecordList.2", "Material Usage"}}) in #"Renamed Columns"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy