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 / Count empty rows in a ...
Power Apps
Unanswered

Count empty rows in a gallery

(0) ShareShare
ReportReport
Posted on by 44

tu22_0-1669291937639.png

I am trying to count empty rows in a gallery but it returns false when all rows are empty, what am i missing?

i also want to patch only the rows that have data to my source.

Categories:
  • Sundeep_Malik Profile Picture
    6,501 on at

    Hey @tu22 

     

    This is my gallery:

     

    Sundeep_Malik_0-1669294545943.png

     

    To count the empty rows: 

    I applied the following formula on a text label:

    CountRows(

    Filter(
    DataSource,
    IsBlank(ColumnName)
    )

    )

  • tu22 Profile Picture
    44 on at

    @Sundeep_Malik yes i tried this but it doesn't give me the desired output. as seen in the screenshot, the comments column is empty but it returns false instead of true.

    first, i am trying to test for blank columns

    then, i am trying to count how many rows in the gallery are blank

    finally, i am trying to patch the non-blank rows to my datasource.

  • MarkRahn Profile Picture
    1,424 Super User 2026 Season 2 on at

    Here are a couple of things to try:

    1) try using IsBlankOrError() instead of IsBlank() to see if that gives you the desired results.

     

    2) If you are using a Collection to populate your Gallery, then try the following:

      a) when you load your Source Collection, also create a copy called colEdit.

      b) add a new Column to the colEdit collection named "Updated" and set the default value to 0.

      c) for the OnChange event of your controls in the Gallery Template, use a Patch statement on the colEdit Collection to update the column/field that is changed and set the "Updated" column to 1.

      d) Assuming you have a button or something similar to kick off the row updates to your data source, filter the colEdit Collection using "Updated" = 1.

     

    This should allow you to only update/patch your data source with the changes that have been made.

     

    Assumptions: Your Source Collection has a unique identifier so that ThisItem.ID or something similar would be valid.

     

    You might be wondering "why use two collections? Just added the Updated field to a single collection." In my use of Galleries and Collections, I have found that having a Source collection and an Edit Collection allows things to work as expected. If you Patch the Source Collection with updates, you sometimes end up with a Refresh on the Gallery with unintended results. Note: You can use a Collect statement on your Source and Edit Collection to add a new row/item and that does not cause a Refresh issue (for whatever reason).

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard