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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
nic0dav
New Member

How to retrieve comments from a SharePoint list into Power BI ?

Hello,

 

I have linked y power BI report to a sharepoint list, I can see most information in the Power BI table but I cannot find the comments, is there a way to retrieve them?

 

Thank you

1 ACCEPTED SOLUTION
4 REPLIES 4
Thp889
Regular Visitor

Try This It should run through your list and give you all the comments, may be able to filter them out?

let
    siteUrl = "https://yoursiteurl",
    listName = "your list name",

    // Step 1: Get all item IDs
    listApiUrl = "_api/web/lists/getbytitle('" & listName & "')/items?$select=Id",
    itemResponse = Json.Document(Web.Contents(siteUrl, [
        RelativePath = listApiUrl,
        Headers=[Accept="application/json;odata=verbose"]
    ])),
    itemData = itemResponse[d][results],
    itemTable = Table.FromRecords(itemData),
    itemIds = Table.Column(itemTable, "Id"),

    // Step 2: Define comment fetcher with RelativePath
    GetComments = (itemId as number) as table =>
        let
            commentsPath = "_api/web/lists/getbytitle('" & listName & "')/items(" & Text.From(itemId) & ")/Comments()",
            response = Json.Document(Web.Contents(
                siteUrl,
                [
                    RelativePath = commentsPath,
                    Headers = [Accept="application/json;odata=verbose"]
                ]
            )),
            commentData = response[d][results],
            commentTable = Table.FromRecords(commentData),
            withItemId = Table.AddColumn(commentTable, "ItemId", each itemId)
        in
            withItemId,

    // Step 3: Loop through item IDs
    allComments = List.Transform(itemIds, each try GetComments(_) otherwise null),
    filteredComments = List.RemoveNulls(allComments),
    combinedComments = Table.Combine(filteredComments)
in
    combinedComments

 

nic0dav
New Member

Thank you !

amitchandak
Super User
Super User

Has anyone figured out how to clean up mentions in the comments?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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