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 Apps - Building Power Apps
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

GroupBy and CountRows are not including records with zero counts

Posted on by

Let's say I have the following SharePoint list.

 

PersonDeviceDateReturned
Sam BLaptop7/1/2024
John SLaptop 
Jane DLaptop 
Jane DMonitor 

 

In my gallery, I want to display the following, where only those without a DateReturned have a count above 0:

 

Sam B

Devices: 0

----------------

John S

Devices: 1

----------------

Jane D

Devices: 2

 

The code below with GroupBy and CountRows is only returning records with counts above 0, which makes sense, since I am filtering for DateReturned = Blank().  This code returns:

 

John S

Devices: 1

----------------

Jane D

Devices: 2

 

Sort(
 Search(
 AddColumns(
 GroupBy(
 Filter('Inventory', DateReturned = Blank()),
 Username,
 GroupedItems
 ),
 IssueCount,
 CountRows(GroupedItems)
 ),
 txtEmployeeSearch.Value,
 Username
 ),
 Username
)

 

Is there a way for me to return ALL records (without the DateReturned filter), but have the CountRows return 0 for those with no blank DateReturned values?  It would be like a LEFT JOIN in SQL, but I haven't been able to figure it out.  I tried placing the data in a collection and playing with it, but the GroupBy stopped working and it was showing separate records because I included the DateReturned in the results, so I could find a way to work around it.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 321 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 289 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 200 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics