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 / How to create a collec...
Power Apps
Answered

How to create a collection with a CountRows column from another table/list

(0) ShareShare
ReportReport
Posted on by 51

Hello!

 

I have 2 tables/lists & want to get a count of records with a like tie:

 

Projects

IDTitleDescription
24This is My Title ADescribing stuff about A
31This is My Title BDescribing stuff about B
33This is My Title CDescribing stuff about C

 

 

Tasks

IDTitleProjectTie (SharePoint Lookup to Projects.ID)
10This is My Task Title A24
11This is My Task Title B24
12This is My Task Title C31
14This is My Task Title D33
15This is My Task Title E33

 

I am trying to AddColumns in a collection (for a gallery) that will capture the count of Tasks for each Project like this:

IDTitle (Project)DescriptionTaskCount
24This is My Title ADescribing stuff about A2
31This is My Title BDescribing stuff about B1
33This is My Title CDescribing stuff about C2

 

 

I've tried this & a few other iterations of it but the count is either 0 of total count of ALL records in the Tasks table: 

 

 

ClearCollect(collProjectswithTaskCount, 
 AddColumns(
 Projects, 
 "TaskCount",
 CountRows(
 Filter(Tasks, ProjectTie.Id = ThisRecord.ID)
 )
 )
);

 

 

I'd greatly appreciate some help on this, thanks!

Categories:
I have the same question (0)
  • Verified answer
    Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @ImaKickUrAsh , I think you were close:

     

    ClearCollect(
     collProjectswithTaskCount,
     AddColumns(
     Projects,
     "count_tasks",
     CountRows(
     Filter(
     AddColumns(
     Tasks,
     "_project_tie",
     ProjectTie.Value
     ),
     Value(_project_tie) = Project[@ID]
     )
     )
     )
    )

     

     

    Please note that the AddColumns function is not delegable.

  • ImaKickUrAsh Profile Picture
    51 on at

    Perfect! Thank you so much 🙂

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard