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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Stella_V
Frequent Visitor

Repeat a small list of values on the whole column (without creating duplicate rows)

Hello 

 

I need to repeat a set of text values in the whole column, let's say: 

 

Apple

Oranges

Pears

Apple

Oranges

Pears

Apple

Oranges

Pears

Apple

Oranges

Pears

Apple

Oranges

Pears

 

 

I tried with the custom column : = Table.AddColumn(#"Added Conditional Column", "Custom", each {"Apple", "Orange", "Pears"}) but it gives me a list which then when I extend, is creating 3 new rows for one old. 

 

Any idea how to solve that?

 

thanks a lot

Kind regards

Stella

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Stella_V ,

Consider adding an [Index] column before creating a custom column like this:

if Number.Mod([Index],3) = 1 then "Apple" else if Number.Mod([Index],3) = 2 then "Oranges" else "Pears"

vcgaomsft_0-1698652383428.png
Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HcW5DQAgDACxXVKzBF8kfqij7L8G0rmxmcQoHkxSopypFKqVVKk16p3GoDlpLdqbzqF76T1x/w==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if Number.Mod([Index],3) = 1 then "Apple" else if Number.Mod([Index],3) = 2 then "Oranges" else "Pears")
in
    #"Added Custom"

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

View solution in original post

3 REPLIES 3
Stella_V
Frequent Visitor

thank you 🙂

Anonymous
Not applicable

Hi @Stella_V ,

Consider adding an [Index] column before creating a custom column like this:

if Number.Mod([Index],3) = 1 then "Apple" else if Number.Mod([Index],3) = 2 then "Oranges" else "Pears"

vcgaomsft_0-1698652383428.png
Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HcW5DQAgDACxXVKzBF8kfqij7L8G0rmxmcQoHkxSopypFKqVVKk16p3GoDlpLdqbzqF76T1x/w==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if Number.Mod([Index],3) = 1 then "Apple" else if Number.Mod([Index],3) = 2 then "Oranges" else "Pears")
in
    #"Added Custom"

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

HotChilli
Community Champion
Community Champion

List.Repeat

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.