Forum Discussion
Split into new rows using delimiter, but last value also has delimiter
- Anonymous2 years ago
Hi fox_NL ,
You need to run the code given by AlienSx before the split step.
Typically, we refer to the name of the previous step as the your_table parameter.Output:
You can also create a new blank query to copy the code below into the advanced editor to see all the steps.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZHNasMwEIRfZfE5EGsl/0Q6hZTeDKW09GBy2MQKDnUss3EDffsqcnDttATESFo0H9rZsoxEtIgELrMlxihBxDrOdKJgXfj6G3/tP/3+6twBej6ezEdtbQPE+xoO7Np+WmBLbPxriLaLMsIZ1zP9kgN24y6W/f5MLXQN9dafC2ogM1ddBVVB0QSW/MuS+Zz15BzD2fYjKhjVnRGlFvjQiGb6kwBJBkg6QFAnqUYFL1NIQccW9uOlATlpIgmaDrB0BhNCx0KrfB73e9dZhtOVuXPVN1R0rneOuPpNN/sHI29T2xDThdrb3DriHpQYnfnMudKY+Dgfz0WY+2TysaXtDw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [No = _t, Date = _t, Category = _t, Parts = _t, Moulds = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"No", Int64.Type}, {"Date", type datetime}, {"Category", type text}, {"Parts", type text}, {"Moulds", type text}}), trim_end = Table.TransformColumns(#"Changed Type", {{"Parts", each Text.TrimEnd(_, ";")},{"Moulds", each Text.TrimEnd(_, ";")}}), #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(trim_end, {{"Parts", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Parts"), #"Split Column by Delimiter1" = Table.ExpandListColumn(Table.TransformColumns(#"Split Column by Delimiter", {{"Moulds", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Moulds") in #"Split Column by Delimiter1"More details, please refer to:
Power BI Forum Help: How to integrate M-code into ... - Microsoft Fabric CommunityBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi fox_NL ,
You need to run the code given by AlienSx before the split step.
Typically, we refer to the name of the previous step as the your_table parameter.
Output:
You can also create a new blank query to copy the code below into the advanced editor to see all the steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZHNasMwEIRfZfE5EGsl/0Q6hZTeDKW09GBy2MQKDnUss3EDffsqcnDttATESFo0H9rZsoxEtIgELrMlxihBxDrOdKJgXfj6G3/tP/3+6twBej6ezEdtbQPE+xoO7Np+WmBLbPxriLaLMsIZ1zP9kgN24y6W/f5MLXQN9dafC2ogM1ddBVVB0QSW/MuS+Zz15BzD2fYjKhjVnRGlFvjQiGb6kwBJBkg6QFAnqUYFL1NIQccW9uOlATlpIgmaDrB0BhNCx0KrfB73e9dZhtOVuXPVN1R0rneOuPpNN/sHI29T2xDThdrb3DriHpQYnfnMudKY+Dgfz0WY+2TysaXtDw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [No = _t, Date = _t, Category = _t, Parts = _t, Moulds = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"No", Int64.Type}, {"Date", type datetime}, {"Category", type text}, {"Parts", type text}, {"Moulds", type text}}),
trim_end = Table.TransformColumns(#"Changed Type", {{"Parts", each Text.TrimEnd(_, ";")},{"Moulds", each Text.TrimEnd(_, ";")}}),
#"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(trim_end, {{"Parts", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Parts"),
#"Split Column by Delimiter1" = Table.ExpandListColumn(Table.TransformColumns(#"Split Column by Delimiter", {{"Moulds", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Moulds")
in
#"Split Column by Delimiter1"
More details, please refer to:
Power BI Forum Help: How to integrate M-code into ... - Microsoft Fabric Community
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Thank you very much! I need get used to the naming of the steps in the next. But your images helped me a lot. Perfect!