Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Nested ForAll on Nested Gallery.Allitems

Hi, I was wondering if it is possible to loop through a Nested Gallery?


ForAll(outerGallery.AllItems, ForAll( innerGallery.AllItems, DO FORMULA))

I can do a nested ForAll on a different collection in the outerGallery ForAll without problem.

I have also checked the length of innerGallery.AllItems by placing a Label in the outerGallery with the CountRows(innerGallery.AllItems) and It does show a proper length. 
For some reason it doesn't see the length of innerGallery.AllItems outside of the loop or something?

Is this by design or a bug or ...?

Thanks in advance


Super User
Super User

Re: Nested ForAll on Nested Gallery.Allitems

How big are your galleries?

Level: Powered On

Re: Nested ForAll on Nested Gallery.Allitems

Well I tested it with my inner galleries having 10 Items and my outer gallery being 5 items long

Super User
Super User

Re: Nested ForAll on Nested Gallery.Allitems

If your formula is intended to get a total number of rows for all inner and all outer rows combined, I'm not sure that is going to work in general.  Unless you append a variable every time.  I think you will end up getting just the number of rows in the last sub-gallary for each.  CountRows() does not sum up as you go.  Its a one time result.  It does not accumulate.  You probably need to get a variable going and use it to do a loop sum, so to speak.  I dont have a lot of time today to put an example together.

Helpful resources


Power Apps Super User Class of 2020

Check it out!


Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,075)