cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Count number of records - number comes from another sharepoint list

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

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

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 Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Super User III
Super User III

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.

Anonymous
Not applicable

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

Kindly show a screenshot of the Gallery items of both Galleries

Anonymous
Not applicable

 have included the screenshots  from gallery 1 and 2 

 

thanks

Community Support
Community Support

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 Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

It worked .. thanks !!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (47,390)