web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trouble Adding a Colum...
Power Apps
Unanswered

Trouble Adding a Column to a Collection with a SharePoint Online List datasource

(0) ShareShare
ReportReport
Posted on by 101

I created a gallery using Database A that contained one column called Employee Name. In the gallery, I then manually a column that performs a count of how many times the Employee name is found in database B.

 

Example:


Sally Jo    8

Billy John 10

David Joseph 12

 

Whenever I add a chart to my PowerApps and use the gallery as the data source, my number column is never available as an option.

 

Then, I tried to create a collection, but I kept getting errors:

 

Collect(SVMLeadChartData, AddColumns(SVMLeadChart.AllItems, "Total", Value(SVMLeadCount.Text) ) ) - For Total, I get the Expected Identifier Name error.

 

Categories:
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @boom_powerapps ,

     

    Please try to use 

    AddColumns(SVMLeadChart.AllItems, Total, Value(SVMLeadCount.Text) ) 

    instead of using 

    AddColumns(SVMLeadChart.AllItems, "Total", Value(SVMLeadCount.Text) ) 

     

    Best Regards,

    Wearsky

  • Cat Schneider Profile Picture
    488 Most Valuable Professional on at

    How did you add the count value to the records of the Gallery exactly? Is it in the Items property? Or is it with a control like a label that's doing a row count?

    The easiest way to do this would most likely be to use the AddColumns() function with the CountIf() function...

    You can either do so with a Collection or directly in the Gallery Items property, but it would look something like:

    AddColumns(
     DataSourceA As a,
     countFromB,
     CountIf(
     DataSourceB As b, 
     a.Name = b.EmployeeName
     )
    )


    Let me know if that helps, or if you are still encountering issues.

  • boom_powerapps Profile Picture
    101 on at

    @v-xiaochen-msft This worked perfectly!!

     

    I created a button with the following code:

     


    Collect(SVMLeadTracker, AddColumns(SVMLeadChart.AllItems, Total, Value(SVMLeadCount.Text) ,
    SVMLead, SVMTeamMember.Text & " " & Value(SVMLeadCount.Text) ) );

     

    //Create Row for Dummy User
    ClearCollect(SVMLeadDummy,
    {SVMLead: "No SVM Leads" & " " & CountIf(SVMRequests, IsBlank('SVM Lead')),
    Total: CountIf(SVMRequests, IsBlank('SVM Lead'))}

    );

     

    //Insert new dummy row
    ClearCollect(SVMLeadTracker2, SVMLeadTracker);
    Collect(SVMLeadTracker2, SVMLeadDummy);

    Set(ShowSVMLeadChartContainer, true)

     

    The code works perfectly in the portal studio (below).

     

    Correct.png

     

    But when I publish the app, the FIRST time users click on the button that displays the graph, they see this (below):

     

    Incorrect.png

     

    When the user closes the graph and then opens it again, the information is displayed correctly. 

     

    The number 42 is a total for one person; each other person has their own totals as shown in the first screenshot. Any idea how to make sure the collection is run correctly outside of the app studio the first time?

  • MalryTech Profile Picture
    79 on at

    I'm facing the same "Expected identifier name" error.  Here is my code: 

     

    App, OnStart

    ClearCollect(
        ActiveContacts,
        Filter(Contacts, Active = true)
    );

    ClearCollect(
        FinalFilteredContacts,
            Filter(
                ActiveContacts,
                !IsBlank('Mailing Street') && NewWorksite = galWorksites.Selected.'SF ID 18'
            )
        );
     
    Items: AddColumns(FinalFilteredContacts, "FullAddr", 'Mailing Street' & ", " & 'Mailing City' & ", CA " & Zip5)
     
    ItemsAddress: "FullAddr" --obviously this part isn't working yet.
     
    Please advise.  Thanks.
     
     
  • MalryTech Profile Picture
    79 on at

    My apologies.  I found an article which pointed out you do not need double quotes anymore when doing AddColumns.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard