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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
Super User
Super User

List.Repeat

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors