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 / Count Rows with Filter...
Power Apps
Unanswered

Count Rows with Filter function on multiple tables

(0) ShareShare
ReportReport
Posted on by 14

Hi all,

In my power apps, i use dataverse as datasources, my table structures like this:

 

1. table staff (contact staff information i.e. name...) 

2. table staff payroll (monthly payroll record for each staff)

3. table roster ( daily record of each staff payroll with the duty status)

4. table duty code (each code status is on duty or off duty) 

 

I would like to get the total of rows count for each staff on that staff payroll month onduty days (duty code is onduty= yes)

 

I managed to show in the gallery for the total numbers of days in that table roster (31 is total days for Oct) using this formula : CountRows(Filter('Staff Rosters',PayrollID=ThisItem.PayrollID))

 

However,  I am not able to get total of onduty days using this formula :CountRows(Filter('Staff Rosters',PayrollID=ThisItem.PayrollID, DutyCode=Filter('Staff Roster Types',OnDuty=true)))

 

Nealsum_0-1668694179385.png

 

 

I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @Nealsum,

    Modify as below:

    CountRows(Filter('Staff Rosters',PayrollID=ThisItem.PayrollID, DutyCode=LookUp('Staff Roster Types',OnDuty=true).DutyCode))

    Note that you should lookup a duty code based on the OnDuty=true in the staff roster types table.

  • Nealsum Profile Picture
    14 on at

    Thanks for reply, however it doesn't work work and result in delegation warning.

     

    I would like to count the total of records where the duty code is onduty=yes

     

    here's the staff roster types table

    Nealsum_0-1668779968207.png

     

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @Nealsum,

    CountRows() function does cause the delegation warning, which is by design if you have more than 2000 records.

     

    Further, to filter the CodeName with onduty=yes, please modify your formula as below:

    Filter('Staff Roster Types',OnDuty='OnDuty ('Staff Roster Types')'.Yes)

    vqiaqimsft_0-1669270175299.png

    Note that you should refer to Field(TableName).Yes

     

  • Nealsum Profile Picture
    14 on at

    I found that my lookup table setting is setup incorrectly, now i can easily get the onduty count. thanks for the update anyway

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard