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 / CountRows of Parents' ...
Power Apps
Unanswered

CountRows of Parents' Children

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I have two databases, one is for parent and one is for the child.  In parents database, I have a column named 'Code' while in child database, there's a column named 'childCode' which is the foreign key(related to 'Code' from parents database). Let say I have 5 records of code 'A1' and 3 records of 'B1' in child's database. How can I show this total number(or rather countrow) of each parents' child record in my gallery? I tried to use CountRows but seems just can't get it right. Hoping to get some inputs from you. Thanks guys.

Categories:
  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @Anonymous ,

     

    It looks like this post is same as what you are looking for.  Hopefully this helps!  https://powerusers.microsoft.com/t5/Building-Power-Apps/How-show-number-of-children-in-parent-gallery-item/td-p/335309

     

    Thanks,


    Drew

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    Hi @Anonymous ,

    If correctly understand your issue, your gallery items property should look like:

    GroupBy(childTable, “childCode”,”Result”)

    and inside the gallery put a label with the text property set to:

    CountRows(ThisItem.Result)

     

    Hope it helps !

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the feedbacks! I forgot to mention that I want to show that inside the parents' gallery. So I created a label and want that label shows the total number of child having that particular code. If I set the property to CountRows(childTable.childCode), the label will show the total number of all child(regardless the code), which is not what I want. I tried 'ThisItem.Code=childTable.childCode' but no success.

     

    Thanks @dpoggemann . I saw that solution but is it possible if I dont want to have another gallery inside another gallery? Instead just one parents gallery with a label that shows the number of rows related to the child?

    Thank you again!

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @Anonymous ,

     

    In this case, instead of using CountRows(childTable.childCode), use in label (inside parent gallery)- Text property:

    CountRows(Filter(childTable,childCode=Thisitem.Code))

    but this can cause loading delay on a large set of date as you'll distinctly interogate childTable for each parent Code.

     

    Hope it helps !

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard