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 / Filtering Countrows in...
Power Apps
Answered

Filtering Countrows inside Collection

(0) ShareShare
ReportReport
Posted on by 61

Hi, I am trying to Add additional Columns "Approved" and "Pending decision" according to items status and Client Name, I was able to get it working however the count of the items is the same all across the rows and it seems it is not filtering the Client accordingly, this is the code I am using on start... I am adding the column inside colBillings that is afterwards Grouped into another Collection colDashboard that is afterwards displayed in Table's Items property:

 

ClearCollect(
colDashboard,
GroupBy(
AddColumns(
colBillings,
"Client",
ClientName,
"RequestorName",
RequestedBy.DisplayName,
"Pending",
CountRows(
Filter(
colBillings,
ClientName = ClientName,
DocumentStatus = "Pending decision"
)
),
"Approved",
CountRows(
Filter(
colBillings,
ClientName = ThisRecord.ClientName,
DocumentStatus = "Approved"
)
)
),
"Client",
"RequestorName",
"Pending",
"Approved",
"GroupData"
)
);

 

Here I would like to have the count to be filtered correctly by Client name:

 

Screenshot_1.png

 

Thanks a lot for your help,

 

BR,

 

Michal

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

    Hi @MichalBr89 ,

     

    When using Filter or LookUp inside AddColumns or ForAll, you need to use As operator to resolve ambiguity. Besides, it seems you would like to get entries from colBillings that are only with "Pending decision" and "Approved". If this is the case, please try below formula instead:

    ClearCollect(
     colDashboard,
     AddColumns(
     GroupBy(
     AddColumns(
     colBillings As CB,
     "Client",
     ClientName,
     "RequestorName",
     RequestedBy.DisplayName,
     ),
     "Client",
     "RequestorName",
     "GroupData"
     ) As GB,
     "Pending",
     CountRows(
     Filter(
     GB.GroupData,
     DocumentStatus = "Pending decision"
     )
     ),
     "Approved",
     CountRows(
     Filter(
     GB.GroupData,
     DocumentStatus = "Approved"
     )
     )
     )
    );

     

    Best regards,

  • MichalBr89 Profile Picture
    61 on at

    @v-jefferni  - Thank you, Sir! I have to remove 'As CB' from AddColumns(ColBillings, but afterwards it worked perfectly!

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