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 items in a gallery
Power Apps
Unanswered

Count items in a gallery

(0) ShareShare
ReportReport
Posted on by 3,271

Hi there,

 

Quick question here?

 

I have a gallery with a couple of labels, one of the labels is the result of a radio button with items "Single" and "Double" I would like to add outside of that gallery to labels to show the total value of:

 

Total Singles :

 

Total Doubles:

 

Could someone point me in the right direction?

 

Thanks in advance

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    If the name of the gallery is Gallery1, you can (outside of the gallery) get the number of items in the gallery using:

    CountRows( Gallery1.AllItems )


    The AllItems here is the key as it references each "row" in the gallery.  I'd imagine you could use Gallery1.AllItems and filter it before doing the CountRows() in order to see how many of each were "single" or "double".  

     

    Hope this helps!

  • Community Power Platform Member Profile Picture
    on at

    Hi sajarac 

    As an idea you could define a variable when each radio button is selected, then use the CountRows function to count rows in the gallery that is filtered by that variable / radio button selection?

     

    Radio button OnSelect:

    UpdateContext({ItemSelection: Radiobutton.Selected.Value})

     

     

    Then the row count might be displayed in a label with Text:

    CountRows(Filter(Collection, [Column used to determine Single/Double] = ItemSelection))
  • Sajarac Profile Picture
    3,271 on at

    Wow, thank you very much for this prompt response.

     

    So you mean apply two filters?

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Yes,

    But let's say your radio box (let's call it Radio1) that is within the gallery looks like this:

    radiobox.PNG

     ie: where Items = [ "Single", "Double" ]

    so your filters would be:

     

    • Total Items in the Gallery:   CountRow( Gallery1.AllItems )
    • Num where Radio is Single:  CountRows( Filter( Gallery1.AllItems, Radio1.Selected.Value = "Single" ) )

    • Num where Radio is Double:  CountRows( Filter( Gallery1.AllItems, Radio1.Selected.Value = "Double" ) )

    You'll want to double check the syntax in the filter, but I believe this is correct.

  • Sajarac Profile Picture
    3,271 on at

    Thank you very much for your prompt response!!!

  • Community Power Platform Member Profile Picture
    on at

    Glad to be of help.  I was working in a gallery this evening (see my other post) and this was easy for me to try at the time.  🙂

  • JuliusDoldPP Profile Picture
    2 on at

    Its countRowinstead of countRow 😉

  • Benkex Profile Picture
    2 on at

    Gallery1.AllItemsCount

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