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
DavelinaJolie
Regular Visitor

Extracting a SharePoint List Person Picker with empty values

Hi,

 

I'm currently working on creating a dashboard which uses a SharePoint Online List. The list uses a person picker for the "Assigned to" field.

 

What I want to do is extract the [title] field where multiple users exist and use a comma separator. I'm using the below M code for this. However it generates Errors where a user is not selected in the List. Is there a way to handle the blanks where these occur?

 

= Table.TransformColumns(#"...", {"Assigned to", each Text.Combine(List.Transform(Table.TransformRows(_, each [title]), Text.from), ", "), type text})

 

Sorry, I should say the error is

 

Expression.Error: We cannot convert the value null to type Table. So I gather that because the field is null that it can't perform the action of conversion?

1 ACCEPTED SOLUTION
DavelinaJolie
Regular Visitor

I think I found a different solution.

 

I adapted this:

 

https://community.powerbi.com/t5/Desktop/Extract-table-from-column/td-p/1022979

 

To create a new column but used Table.SelectColumns to specify the exact column I wanted as so:

 

if [Assigned to] is table 

then 

  Text.Combine(

    List.Transform(

      List.Combine(Table.ToRows(Table.SelectColumns([Assigned to], "title"])))

      , each Text.From(_)

      )

    ,","

    )

else [Assigned to]

 

Which returns the items in the specified column delimited by comma, unless the original column value is null, in which case it returns a null.

View solution in original post

1 REPLY 1
DavelinaJolie
Regular Visitor

I think I found a different solution.

 

I adapted this:

 

https://community.powerbi.com/t5/Desktop/Extract-table-from-column/td-p/1022979

 

To create a new column but used Table.SelectColumns to specify the exact column I wanted as so:

 

if [Assigned to] is table 

then 

  Text.Combine(

    List.Transform(

      List.Combine(Table.ToRows(Table.SelectColumns([Assigned to], "title"])))

      , each Text.From(_)

      )

    ,","

    )

else [Assigned to]

 

Which returns the items in the specified column delimited by comma, unless the original column value is null, in which case it returns a null.

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.

Top Solution Authors
Top Kudoed Authors