Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gehe_muc
Frequent Visitor

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:

 

gehe_muc_0-1655453145065.png

 

Thanks for your kind help!

 

Steve

1 ACCEPTED SOLUTION
rohit_singh
Solution Sage
Solution 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

rohit_singh_0-1655454406872.png

 

 

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! 🙂

View solution in original post

2 REPLIES 2
rohit_singh
Solution Sage
Solution 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

rohit_singh_0-1655454406872.png

 

 

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! 🙂

Thanks Rohit, works very well - 😊

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors