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

Count Rows with Filter Delegation problem

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Guys,
I am having issue with count rows delegation and I need to fix it before the total record goes beyond 2000 records. I am using below countRows formula. What I am trying below is getting count of record based on Year(date of application) and adding + 1 to last record when new record is created.

 

asif082_1-1641866551275.png

 

 

 Does, anyone know the workaround please I need this desperately. 

 

Thanks.

Categories:
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    I think the only way to do this will be to construct a starting date of "01/01/(year)" and an ending date of "12/31/(year)" and then filter on Greater than or equal to and less than or equal to.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for this Pstork1. I have change it to below but still no luck.

    asif082_0-1641873225918.png

     

    I have change application date to string and doing greater than eql against selected date.

     

    Thanks

  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @Anonymous ,

    Another idea as you are always dealing with the current year, this will give you up to 2,000 in the year. CountRows is simply not Delegable (nor is Year). You will also not get a Delegation warning here, but if the current year goes over 2,000 records, your count will be wrong.

    'SW ApplicationNumber': 
    Text(Year(Now()) & "-" & 
    With(
     {
     wList:
     Sort(
     SW_Details,
     'Date Application received',
     Descending
     )
     },
     Text(
     CountRows(
     Filter(
     wList,
     Year('Date Application received') = Year(Today())
     )
     ) + 1,
     "00000"
     )
    )

    Or you could grab the last app no field entered, get the number part and add 1

    'SW ApplicationNumber': 
    Text(Year(Now()) & "-" & 
    With(
     {
     wList:
     Sort(
     SW_Details,
     'Date Application received',
     Descending
     )
     },
     With(
     {wLastNo:Last(wList).'SW ApplicationNumber'},
     Text(
     Value(
     Right(
     wLastNo, 
     Len(wLastNo) - 5
     )
     ) + 1,
     "00000"
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks Warren, really appreciate the help here. One of the requirement is after the year end the number will be reset e.g. if year 2022 end with 2022-99912 then 2023 will start from 2023-00001 so I guess solution 1 will work in this scenario? 

     

    Thanks

  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @Anonymous ,

    The second one should and if you manually enter the first one for the year in the first, it will also. Auto-changeover is possible, but a whole new level of complexity,

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Warren,

    Yeah it needs to auto reset after year ends. In my original example it was possible until i found it cannot goes beyond 2000 records. Do you have any solution how can I auto reset it each year without using year() since its not delegable.

    Thanks

  • Verified answer
    WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @Anonymous ,

    For the first example

    'SW ApplicationNumber': 
    Text(Year(Now()) & "-" & 
    With(
     {
     wList:
     Sort(
     SW_Details,
     'Date Application received',
     Descending
     )
     },
     If(
     Left(
     First(wList).'SW ApplicationNumber',
     4
     ) = Text(Year(Today())),
     Text(
     CountRows(
     Filter(
     wList,
     Year('Date Application received') = Year(Today())
     )
     ) + 1,
     "00000"
     ),
     "1"
     )
    )

    and the second

    'SW ApplicationNumber': 
    Text(Year(Now()) & "-" & 
    With(
     {
     wList:
     Sort(
     SW_Details,
     'Date Application received',
     Descending
     )
     },
     With(
     {wLastNo:Last(wList).'SW ApplicationNumber'},
    	 If(
     Left(
     wLastNo,
     4
     ) = Text(Year(Today())),
     Text(
     Value(
     Right(
     wLastNo, 
     Len(wLastNo) - 5
     )
     ) + 1,
     "00000"
     ),
     "1"
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks Warren you a legend. Appreciate the help into this.

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 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard