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 / Counting rows using Gr...
Power Apps
Answered

Counting rows using GroupBy - but returns blank field

(0) ShareShare
ReportReport
Posted on by 40
I am trying to read the count of pallets for each trip.
The follow code should work, but does not.
The result are as many rows as there are trip_id's, but the count_p is blank.
The ID in the table auto-increment.
 
This is what I think should work, but it does not.
 
Any ideas how to do this?
 
trip_pallet_count = DropColumns(
    AddColumns(
        GroupBy(
            pallets,
            trip_id_display,
            id
        ),
        count_p,
        CountRows(id)
    ),
    id
);
I have the same question (0)
  • Verified answer
    SaiRT14 Profile Picture
    1,990 Super User 2025 Season 1 on at
    Here is the update code:
    trip_pallet_count = DropColumns(
        AddColumns(
            GroupBy(
                pallets,
                "trip_id_display", // Group by this field
                "grouped_data"     // Name for the grouped data table
            ),
            "count_p",           // New column for the count of pallets
            CountRows(grouped_data) // Count rows in the grouped data table
        ),
        "grouped_data"         // Remove the grouped data column if not needed
    );
     
     
    your code had following issues:
    The GroupBy function doesn't automatically create a collection of rows in a usable format for the CountRows function.
    The CountRows function is attempting to count rows in the id field, which is not the correct way to reference a grouped collection.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard