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 function is no...
Power Apps
Unanswered

Countif function is not returning a result

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am trying to create some logic based on the result of a countIf function but for some reason the countif function is returning a 0 result even though it should be returning a count of 4 for the particular record I am looking at, but if I use the same operation and combine a CountRow and Filter formulas, it returns the correct result. Any ideas on why CountIF is not working even though it is the same exact condition? These formulas are entered into fields in a gallery.



CountRows(Filter('[dbo].[tblData_VendorMasterSSPaymentTerms]',ThisItem.VMSSPayTermsCLM_ContractID=VMSSPayTerms_AribaContractID))



CountIf('[dbo].[tblData_VendorMasterSSPaymentTerms]',ThisItem.VMSSPayTermsCLM_ContractID=VMSSPayTerms_AribaContractID)

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    Can you try to modify your CountIf formula as:
     
    CountIf('[dbo].[tblData_VendorMasterSSPaymentTerms]',VMSSPayTerms_AribaContractID=ThisItem.VMSSPayTermsCLM_ContractID)

     

    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you mean that these two formulas return different results?

    Did you get delegation warning?

     

    Best regards,

    Community Support Team _ Phoebe Liu

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at
    Yea I tried flipping the condition. no avail unfortunately.
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at
    Yea the countif function returns 0 when it should be 4.

    The combination of count rows and filter returns the correct result, but includes a delegation warning
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Well, that should be related to delegation problem.

    That's PowerApps itself limit.

    If your record is smaller than 2000, you could change the limit to 2000 to avoid this problem.7124.PNG

     

    If your record is lager than 2000, you should use delegable functions. If you do not use, you may get wrong result like your issue.

    Here are some docs about delegable functions:( different data source have different delegable functions)

    https://docs.microsoft.com/en-us/connectors/commondataservice/

    https://docs.microsoft.com/en-us/connectors/sharepointonline/

    https://docs.microsoft.com/en-us/connectors/sql/

     

     

     

    Best regards,

    Community Support Team _ Phoebe Liu

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at
    I would agree but the count if formula is.not returning the correct result and is not the getting a delegation warning.

    The formula that is returning the correct result has the delegation warning so that is not the issue.
  • LegoLad20 Profile Picture
    2 on at

    Hey @Anonymous , 

    Were you able to find a solution to this? I am having the exact same issue currently.

     

    Thanks

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 842

#2
Valantis Profile Picture

Valantis 563

#3
Haque Profile Picture

Haque 402

Last 30 days Overall leaderboard