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
JustDavid
Helper IV
Helper IV

Insert text to a list dynamically from another list/table

I'd like to 2 things to my existing list.

 

  1. Modify text in list
  2. Append existing list Nth times depending on the values that's coming from another table/list (currently print screen showing as table)

 

From the print screen below, I'm showing you the table/list and end result

 

Tried a different method that can achive my end result via merging, however, it's very slow

 

String to AddString to AddCurrent ListCurrent List Desired ResultDesired Result

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

let
    string_to_add = #table({"Data"}, {{"A"}, {"B"}, {"C"}}),
    list_to_add = List.Buffer(string_to_add[Data]),
    current_list = {"text | text | text", "sometext | sometext | sometext", "string | sometext | anothertext"}, 
    addition = List.TransformMany(
        current_list, 
        (x) => list_to_add, 
        (x, y) => y & " | " & x
    )
in
    addition

View solution in original post

3 REPLIES 3
SundarRaj
Super User
Super User

Hello @JustDavid , here's another very quick way you can approach your query and add the approach to your arsenal. I'll share the snippet of the code used and output image for reference. Thanks

SundarRaj_0-1740422118397.png

SundarRaj_1-1740422153847.png

 

 

Sundar Rajagopalan
AlienSx
Super User
Super User

let
    string_to_add = #table({"Data"}, {{"A"}, {"B"}, {"C"}}),
    list_to_add = List.Buffer(string_to_add[Data]),
    current_list = {"text | text | text", "sometext | sometext | sometext", "string | sometext | anothertext"}, 
    addition = List.TransformMany(
        current_list, 
        (x) => list_to_add, 
        (x, y) => y & " | " & x
    )
in
    addition
jgeddes
Super User
Super User

Here is one way it can be done...

let
    tableSource = 
    #table(
        {"Data"},
        {
            {"A"},
            {"B"},
            {"C"}
        }
    ),
    listSource = 
    {
        "text | text | text", 
        "sometext | sometext | sometext", 
        "string | sometext | anothertext"
    },
    table_to_list = 
    Table.ToList(table),
    table_row_count = 
    List.Count(table_to_list),
    modified_list = 
    List.Transform(
        List.Zip(
            {
                List.Repeat(table_to_list, table_row_count), 
                List.Repeat(list, table_row_count)
            }
        ), 
        each Text.Combine(_, " | ")
    )
in
    modified_list




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.