Forum Discussion
Extracting Email Addresses from a Table Column Based on a Person Data Type
Hi ronaldwanat,
Thanks again for your response and detailed screenshots they were very helpful.
You're correct that the Testers column is coming through as a Table type directly from the SharePoint List connection (rather than a JSON string). That means there's no need to convert it or parse it using Json.Document.
Please try below code:
let
Source = SharePoint.Tables("https://www.sharepoint.com/sites/123456/ABCDEF/", [Implementation="2.0", ViewMode="All"]),
Approvals = Source{[Id="bd29e903-9cfb-4deb-bc7a-789c5c6a7eb0"]}[Items],
ExpandedList = Table.ExpandListColumn(Approvals, "Testers"),
ExpandedRecords = Table.ExpandRecordColumn(ExpandedList, "Testers", {"Name", "Email"}),
Grouped = Table.Group(ExpandedRecords, {"ID"}, {
{"AllEmails", each Text.Combine([Email], "; "), type text}
})
in
Grouped
This should now work without any errors and produce the expected output a single row per ID with the list of emails.
Let me know if this resolves it.
Best Regards,
Ganesh Singamshetty
Hi v-ssriganesh,
Thanks again for your support.
The code did run without error, but I did not get the expected output. Instead this what resulted:
- All columns from the original query were removded and I was only left with two colums (ID and AllEmails)
- The AllEmails column was blank with no email addresses. The total row count was correct though.
Here is the updated code I used:
let
Source = SharePoint.Tables("https://www.sharepoint.com/sites/123456/ABCDEF/", [Implementation="2.0", ViewMode="All"]),
Approvals = Source{[Id="bd29e903-9cfb-4deb-bc7a-789c5c6a7eb0"]}[Items],
ExpandedList = Table.ExpandListColumn(Approvals, "Testers"),
ExpandedRecords = Table.ExpandRecordColumn(ExpandedList, "Testers", {"Name", "Email"}),
Grouped = Table.Group(ExpandedRecords, {"ID"}, {
{"AllEmails", each Text.Combine([Email], "; "), type text}
})
in
Grouped
Following are the list of steps and results. Hopefully this can help.
So far, so good. Testers (people type) is a Table type. Note row number two is unique. Total count of 70 columns and 177 rows is correct.
I expanded one Tester cell and as you can see above it has two people associated with it. My problem from day one, is to extract thoses emails, seperated by commas semicolons but keep all other columns intact (unless we need to replace the Testers columns with the emails, that is fine).
Testers people data type column has been expanded and now displays as a Record type. 70 rows and 328 columns now. In the sample above you can see rows 2 and 3 were expanded to account for the two persons associated with CoCo Control ID 75.1.01.
The Testers column was replace with Name and Email. That is fine, but null is not accurate. These do have people and email addresses which should display.
The row count of 177 makes sense, but all columns have been removed. I need them in place to do my analysis.
And the final steps shows AllEmails blank which is not correct and all other columns are missing.
Thanks again for your support and looking forward to coming up with the final solution.
Regards,
Ronald Wanat
- v-ssriganesh1 year agoCommunity Support
Hello ronaldwanat,
Thanks for getting back.To help you further, could you please provide sample data that clearly illustrates the issue? Kindly ensure the sample data:
- Covers the problem scenario completely
- Is shared in a usable format (not as screenshots)
- Does not include any sensitive or unrelated information
- Includes the expected outcome based on your sample
If you're not sure how to share sample data, here’s a helpful guide:
How to provide sample data in the Power BI Forum - Microsoft Fabric CommunityOnce we have that, we’ll be better able to reproduce the issue and assist you with an accurate solution.
Best regards,
Ganesh Singamshetty