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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors