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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
aaumond
Frequent Visitor

Expand column containing list of records

Hello,

 

I'm trying to expand a column which contains list of records on each cell in Power Query (for  example "Type de prestation" column) :

table with list of records.png 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Each record of lists is organized as follow (self, value and id) :

 2018-05-26 10_45_52-Sans titre - Éditeur Power Query.pngrecord.png

 

The idea would be to concatenate the values ​​"value" contained in each record of the list for each cell, delimiting them with semicolons.

 

For example, for the third row of the table, the celle "Type de prestation" would contain "PMO;Architecture".

 

I don't know if I'm clear... Have you ever done that? If yes, how?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Hi Anthony,

That's good news.

To catch errors in general, you can use try/otherwise.

 

In this case, this should work:

 

= Table.TransformColumns(#"Développer Type de prestation",
{{"Phase projet", each try Combiner.CombineTextByDelimiter(";")(List.Transform( _ , each [value]))
otherwise null, type text}})

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

3 REPLIES 3
OwenAuger
Super User
Super User

Hi @aaumond

 

You should create a new step with code like this.

PreviousStep should refer to the previous step in your existing query.

This is how the code would look in the advanced editor. If you enter in the formula bar by clicking fx, then leave out the step name CombineValueFromRecords.

 

CombineValueFromRecords =
  Table.TransformColumns(
    PreviousStep,
    {
      {
        "Type de prestation", 
        each Combiner.CombineTextByDelimiter(";")(
	  List.Transform( _, each [value] )
        ),
	type text
      }
    }
  )

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hi @OwenAuger

 

Thank you so much for the solution! It works.

 

Just a small detail: when a cell is empty, an error is displayed because it can not convert the null value to a list. How can I avoid this kind of error?

 

2018-05-27 09_33_07-issues - Éditeur Power Query.png

 

Regards,

Anthony

Hi Anthony,

That's good news.

To catch errors in general, you can use try/otherwise.

 

In this case, this should work:

 

= Table.TransformColumns(#"Développer Type de prestation",
{{"Phase projet", each try Combiner.CombineTextByDelimiter(";")(List.Transform( _ , each [value]))
otherwise null, type text}})

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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