Forum Discussion
List and Table Extracting employee name using power query
- 1 year ago
Hi aqeel_shaikh,
Hello,
Thank you for reaching out to the Microsoft Fabric Community Forum.I have successfully reproduced your scenario where the Reportedby column contains a mixture of records, lists, and tables typically occurring when extracting Person/Group fields from a SharePoint list.
As you mentioned, expanding the column using the UI arrows doesn’t show any values this happens when Power Query detects inconsistent or complex structures. To address this, I used a custom column in Power Query that can intelligently detect and extract the employee names from each row, regardless of whether the value is a record, list, or table.
Output Achieved:
Here’s a summary of the final output based on your requirement:
- Single person: John Smith
- Multiple people: Jane Doe, Robert King
- From table: Alice Brown
- Nulls handled without error
- Displayed using Table, Matrix, and Card visuals
Here’s a preview of the result in visuals:
Hello,
Thank you for reaching out to the Microsoft Fabric Community Forum.I have successfully reproduced your scenario where the Reportedby column contains a mixture of records, lists, and tables typically occurring when extracting Person/Group fields from a SharePoint list.
As you mentioned, expanding the column using the UI arrows doesn’t show any values this happens when Power Query detects inconsistent or complex structures. To address this, I used a custom column in Power Query that can intelligently detect and extract the employee names from each row, regardless of whether the value is a record, list, or table.
Output Achieved:
Here’s a summary of the final output based on your requirement:
- Single person: John Smith
- Multiple people: Jane Doe, Robert King
- From table: Alice Brown
- Nulls handled without error
- Displayed using Table, Matrix, and Card visuals
Here’s a preview of the result in visuals:
What I Did:
In Power Query, I added a custom column with the following logic to extract Title from various formats:
if (Type.Is(Value.Type([Reportedby]), type record)) then
try [Reportedby][Title] otherwise null
else if (Type.Is(Value.Type([Reportedby]), type list)) then
Text.Combine(List.Transform([Reportedby], each try _[Title] otherwise null), ", ")
else if (Type.Is(Value.Type([Reportedby]), type table)) then
Text.Combine(List.Transform(Table.ToRecords([Reportedby]), each try _[Title] otherwise null), ", ")
else
null
For Your Reference, I’m attaching the .pbix file.
Thank you.
Hi aqeel_shaikh,
Thank you for reaching out to Microsoft Fabric Community Forum!
It looks like you're working with a column in Power Query that contains either List or Table values, commonly seen when pulling data from an address book or SharePoint-connected Excel file. To help you extract employee names from such data structures, here's how you can proceed.
In the Power Query Editor, start by locating the column that contains the List or Table values. You’ll notice a small icon next to each cell indicating the data type. This will help you identify the column that needs expansion.
Next, click the expand icon located at the top-right of the column header. If the column contains a List, Power BI will offer to convert the list into multiple rows. If it contains a Table, Power BI will display a list of fields available within the table, commonly including fields like DisplayName or Email. From there, you can select the DisplayName field to extract employee names.
If a single cell contains multiple employee names stored as a list, Power Query will break them into multiple rows during expansion. This allows each employee name to appear in its own row, making the data easier to work with and analyze further based on your report needs.
If you prefer to keep all employee names in a single row as a comma-separated string, you can use the Group By feature in the Transform tab. Group the data by a unique identifier such as a Record ID, and create a custom column using the Text.Combine function to merge the names into one field.
Once you're done transforming and formatting the names as needed, click on Close & Apply to load the cleaned-up data into your Power BI model. This will ensure the employee names are correctly displayed and ready for use in reports or dashboards.
We have shared the official documents below for your guidance:
Perform common query tasks in Power BI Desktop - Power BI | Microsoft Learn
Create a report on a SharePoint List in Power BI Desktop - Power BI | Microsoft Learn
Create a semantic model from a SharePoint List - Power BI | Microsoft Learn
Thank you.
- v-sgandrathi1 year agoCommunity Support
Hi aqeel_shaikh,
Hi,
I wanted to check in your situation regarding the issue. Have you resolved it? Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!
- v-sgandrathi1 year agoCommunity Support
Hi aqeel_shaikh,
Just wanted to follow up and confirm that everything has been going well on this. Please let me know if there’s anything from our end.
Please feel free to reach out Microsoft fabric community forum.