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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CountIf on Gallery Label
Power Apps
Answered

CountIf on Gallery Label

(0) ShareShare
ReportReport
Posted on by 3

Hello,

 

I have a nested gallery with a label to indicate if someone is over a maximum number of points. This is a label that I created based on an "If" statement, and therefore not coming directly from a list or other source. I have tried a countif statement to control the displaymode of a button outside the gallery. Context would be that if any of the gallery rows exceed the maximum points, to disable to button until the issue is resolved (points < Weekly maximum). 

 

Here is my code:

Farcole88_0-1642649098204.png

 

My label "Label_OverMax" is based on [If(Sum(Filter(collection, Column=ThisItem.Result), Points) > Value(Label_Max.Text), "Over Weekly Max", "")

 

Does anyone know why the CountIf function is returning 'blank'?

Categories:
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Farcole88 ,

     

    How many items will be there in the Gallery? Can you see any Label_OverMax Label text is "Over Weekly Max"?

     

    It seems like Power fx has the similar issue as in Excel... Please try and use CountRows() for your scenario or add an additional If statement for the CountIf function:

    CountRows(Filter(Gallery_CatActivities.AllItems, Label_OverMax.Text = "Over Weekly Max")) > 0
    If(CountIf(Gallery_CatActivities.AllItems, Label_OverMax.Text = "Over Weekly Max") = 0, true, false)

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Verified answer
    JAWL Profile Picture
    393 on at

    @v-jefferni @Farcole88 ,

     

    The result is still Blank even though I use your formula. Your further guide is highly appreciated.

     

     

    CountRows(Filter(GallerySNGroupTest.AllItems,LabelErrorMessageSNGroup.Text="Required"))

     

     

    JAWL_0-1671697166163.png

    UPDATE: I found the workaround or trick (or probably "bug" / enhancement opportunity for Microsoft to consider).  The formula only works if the Gallery is outside of Form.

    JAWL_1-1671701137303.png

    P.S. it will also work if you just insert a label control (with the exact same formula) into the Gallery which sits inside a form. Once it "links" up, you can then remove the label and the formula should still work.

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard