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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mhunt
Frequent Visitor

Repeat cell text x number of times in a column, list, or table

Need list .PNG

Easiest way to create a new column that consists of the text from column A repeated the number of times designated in column B?

1 REPLY 1
ChrisMendoza
Resident Rockstar
Resident Rockstar

@mhunt -

 

The solution at https://www.mrexcel.com/forum/power-bi/977045-pq-repeat-rows-n-times.html seems to fit your need?

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtRzUdJRMlaK1YlWstBzBLJNlWJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Category = _t, Contents = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Category", type text}, {"Contents", Int64.Type}}),
    Custom1 = Table.TransformColumns(#"Changed Type",{"Contents", each List.Numbers(_,_,0), type list}),
    Custom2 = Table.ExpandListColumn(Custom1,"Contents")
in
    Custom2





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.