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 / CountIf and Help avoid...
Power Apps
Answered

CountIf and Help avoiding delegation flag

(0) ShareShare
ReportReport
Posted on by 72

Hello, 

I am getting a delegation flag with formula below. Trying to count row data for current year. Simplified the formula. I have more selected FieldName = " ", but no need to show long formula in this forum.  The formula yields right count. Just try to build app without delegation flags. 

 

CountIf(Gateways, Region = "North America" && Year('Dates') = Year(Today()) && Reference_Only.Value = "No" && (FieldName.Value = "ABC" || FieldName.Value = "DEF"))

Thanks for the assistance. 
Kevin

Categories:
I have the same question (0)
  • lcimon Profile Picture
    89 on at

    Hello,

     

    You get away from this delegation issue by:

    1. Adding a new column to you datasource to store the Year only. This will help to remove the part Year('Dates') of your formula.
    2. Spliting your formula in 2 steps (the CountIf function isn't delegable) as following:
    With(
     {pRecords: Filter(Gateways, Region = "North America" && YearOnly = Year(Today()) && Reference_Only.Value = "No" && (FieldName.Value = "ABC" || FieldName.Value = "DEF"))},
     CountRows(pRecords)
    )

    Where YearOnly is your new column.

  • radiosonicfan Profile Picture
    72 on at

    Thanks. Think I can ignore. Have under a 1k records and generate about 400-600 records a year.  Assuming if we generated 1k/records/year. It would take a while to hit 50K delegation limit. 

     

    "There is a 50K delegation limit if you use CountRows and CountIf functions with filters. There is no hard limit on the CountRows function when extracted directly from the data source because of the cached count that Dataverse keeps"

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @radiosonicfan :

    I am afraid it is impossible to solve the delegation problem in your formula.

    The point is that "CountRows","Year" are not a delegable functions.Although the delegation warning can be eliminated by using the With function, the limitation still exists.For example:

    I have a list named "BofNewTest" which has 9391 records

    vbofengmsft_0-1633584384678.png

    But I can still only get 500 by this formula although there is no delegation warning.

    vbofengmsft_1-1633584429210.png

    In addition,using Flow can increase the limit of 2k to 5K

    vbofengmsft_3-1633585649272.png

     

    vbofengmsft_2-1633585636535.png

    Best Regards,

    Bof

     

     

  • radiosonicfan Profile Picture
    72 on at

    @v-bofeng-msft Thanks for the feedback. I am going to avoid my I want to do and rely on a Qlik Dashboard for some light metrics reporting. Not going to hold my breathe for Microsoft to implement delegation for CountRows. Planned and 4 years has ticked by....

    radiosonicfan_0-1633980862962.png

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard