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
barthhsk
Frequent Visitor

Extracting text as string from table in column

Hi,

 

I am struggling with following transformation: 

 

From a column "aanleiding toezicht" I need to expand the tables without adding extra rows. Therefore I planned to create  a string of the list which is inside of the table. The length of this list is varying, however the amount of columns is the same for each table.

 

barthhsk_0-1666108566214.png     

My Table is called Tabel. Below a typical example of the list:

barthhsk_1-1666108828900.png

 

The following steps I tried:

result = each if Value.Is(Tabel[aanleiding toezicht],Table.Type) = true
then Text.Combine(Table.ToList(Tabel[aanleiding toezicht]{0}),";")
else Tabel[aanleiding toezicht],
Tabel2 = Table.AddColumn(Tabel,"aanleiding toezicht2", result)

 

Unfortunatly this is resulting in different error messages. My question is, if I am using the right approach?

 

Thank you in advance!

 

 

 

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Hi @barthhsk ,

please try the following:

Tabel2 = Table.AddColumn(Tabel,"aanleiding toezicht2", each if Value.Is([aanleiding toezicht], Table.Type) then Text.Combine([aanleiding toezicht][Element:Text],";")
else Tabel[aanleiding toezicht])

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
barthhsk
Frequent Visitor

Hi @ImkeF,
Thank you for your fast reply. I tried your suggestion. With a slight adaptation - because of the not accepted column name - the problem was solved:

= Table.AddColumn(Tabel,"aanleiding toezicht2", each if Value.Is([aanleiding toezicht], Table.Type) then Text.Combine({[aanleiding toezicht][#"Element:Text"]},";")
else [aanleiding toezicht])

Combined with:

= Table.TransformColumns(Aangepast3, {{"aanleiding toezicht2", each if Value.Is(_,type list) = true 
then Text.Combine(List.Transform(_, Text.From), ";") else _}})

 

ImkeF
Community Champion
Community Champion

Hi @barthhsk ,

please try the following:

Tabel2 = Table.AddColumn(Tabel,"aanleiding toezicht2", each if Value.Is([aanleiding toezicht], Table.Type) then Text.Combine([aanleiding toezicht][Element:Text],";")
else Tabel[aanleiding toezicht])

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

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.