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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Count number of record...
Power Apps
Unanswered

Count number of records - number comes from another sharepoint list

(0) ShareShare
ReportReport
Posted on by

Hello

Bit stuck  with this one  and i hope I can explain it well. I have two SharePoint lists , one is the parent list and it connects to a child list  via an ID  - with a one to many structure>

SharePoint List A                                       Sharepoint List B

ID 7                                 |--------------------------  ID7

                                        |--------------------------  ID7

                                        |--------------------------  ID7                                     

 

I need to display  the count of  the ID  that occurs in the second list in a gallery  that connects to the first SharePoint list

For example :

In Gallery A  - I have ID 7  ( SharePoint list A) ..  

Now in  SharePoint list B , I may  have  ID 7 occurring  9 times.

How do I  display the count in  Gallery A next to the  ID ??

Something that will look like this ...

GALLERY A

ID7 -  Count: 9

-----------------

ID8 -  Count:11

-----------------

ID9 - Count : 4

-----------------

 I need help with the logic behind the count.

Thank you in advance

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    Put this formula in a Textbox:
    CountRows(Gallery2.AllItems,IDColumn)

     

    If you have not already connected your galleries then do this:

    1. Use the SharePoint list A for the first Gallery1
    2. Then Filter the Gallery2: Filter( SharePointList_B,ID=Gallery1.Selected.ID

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    on at

    tried it but telling me i created a circular reference ...

  • eka24 Profile Picture
    20,923 on at

    Kindly show a screenshot of the Gallery items of both Galleries

  • Community Power Platform Member Profile Picture
    on at

     have included the screenshots  from gallery 1 and 2 

     

    thanks

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @Anonymous ,

    Could you please share a bit more about the data structure of your List A and List B?

    Which column do you use to store the ID value of List A within your List B? Number type column or LookUp type column?

     

    Based on the needs that you mentioned, I think the Filter function and CountRows function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

    Set the Items property of the GalleryA to following:

    'Your List A'

    Within the GalleryA, add a Label, set the Text property to following:

    ThisItem.IDColumn & " - Count: " & CountRows(
     Filter('List B', IDColumn_ListB = ThisItem.IDColumn)
     )

    Note: The IDColumn_ListB represents the column in your List B to store the ID value of your ListA. The IDColumn represents the ID column in your List A. On your side, you need to replace it with actual column name from your two SP Lists.

     

    If the IDColumn_ListB is a LookUp type column in your List B, please modify above formula as below:

    ThisItem.IDColumn & " - Count: " & CountRows(
     Filter('List B', IDColumn_ListB.Value = ThisItem.IDColumn)
     )

     

    Please take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on at

    It worked .. thanks !!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard