Forum Discussion
Costum Column: Build a string with a separator based on the number in another column
Helle everybody,
I need a custom column with a string, based on another column with a number:
Thanks for your kind help!
Steve
Hi gehe_muc ,
Here you go. Copy and paste this M-code in a blank query and you'll be able to see the steps.let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlWK1YlWMgaT5mDSEExaKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Number = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Number", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {1..[Number]}), #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ";"), type text}) in #"Extracted Values"Final result
Main idea is to create a list of numbers starting from 1 to <value_in_column>
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂
2 Replies
- rohit_singhSolution Sage
Hi gehe_muc ,
Here you go. Copy and paste this M-code in a blank query and you'll be able to see the steps.let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlWK1YlWMgaT5mDSEExaKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Number = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Number", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {1..[Number]}), #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ";"), type text}) in #"Extracted Values"Final result
Main idea is to create a list of numbers starting from 1 to <value_in_column>
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂- gehe_mucFrequent Visitor
Thanks Rohit, works very well - 😊