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 / Add Columns to collection
Power Apps
Answered

Add Columns to collection

(0) ShareShare
ReportReport
Posted on by 28

Good morning,

 

I am struggling to get the formula correct to add a column to a collection. I want to use the collection as the filter for a drop down elsewhere in the App, when the count of the item = 3, don't show the item. I can get this to work in a gallery, but get a delegation warning.

 

I have 2 SharePoint lists that I am using, 'Tooling List' and 'Tooling Booking List'. I have created 2 collections for those on the App OnStart.

colToolingSets = ClearCollect(colToolingSets, 'Tooling Sets');

and

colBookedOut = ClearCollect(colBookedOut, Filter('Tooling Booking List', OutIn = "Out"));
 
I want to add a column to colToolingSetsWithCount that counts the number of rows in colBookedOut where the Title values for each match.
e.g. Tooling set 100g Set 1 is listed 3 times in colBookedOut
However,  When I use the below code I get 12 for every record which is the total number of rows in the collection, I should only be getting a count of 3 for any Tooling Set. and based on current data, only 4 of the sets have that figure (hence 12, 3 x 4), the other 11 have 0 items booked out.
 
I have used the below to get that outcome, what am I missing..
 
ClearCollect(colToolingSetsWithCount, AddColumns(colToolingSets, "BookedOutCount", CountIf(colBookedOut,Title = Title)));
 
Thanks
Mike
Categories:
  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @MikeBeman ,

     

    Please try this.

    ClearCollect(colToolingSetsWithCount, AddColumns(colToolingSets, "BookedOutCount", LookUp(AddColumns(GroupBy(colBookedOut,"Title","test"),"Count",CountRows(test)),Title=Title,Count)))

     

     

    Best regards,

    Rimmon

  • MikeBeman Profile Picture
    28 on at

    Hi Rimmon, 
    Thanks, this is better, but now I get 3 as the result for all items

  • Verified answer
    BhaskarDhone Profile Picture
    1,398 Super User 2026 Season 1 on at

    your code looks correct only thing is you have common field name hence system is getting confused.

    Try this.

     

    ClearCollect(colToolingSetsWithCount, AddColumns(colToolingSets As Table, "BookedOutCount", CountIf(colBookedOut,Title = Table.Title)));

     

     

  • MikeBeman Profile Picture
    28 on at

    Values I am expecting to seeValues I am expecting to seeWhat is in the collectionWhat is in the collection

  • MikeBeman Profile Picture
    28 on at

    @BhaskarDhone - this worked, thank you!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard