Skip to main content

Notifications

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard