Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

CountRows of Parents' Children

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.

Solution Sage
Solution Sage

Hi @sel_wee01 ,


It looks like this post is same as what you are looking for.  Hopefully this helps!




Super User II
Super User II

Hi @sel_wee01 ,

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:



Hope it helps !


Frequent Visitor

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!

@sel_wee01 ,


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


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 !

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (46,360)