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 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:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    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

Forum hierarchy changes are complete!

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

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard