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 / CountIf Returning Wron...
Power Apps
Unanswered

CountIf Returning Wrong Values

(0) ShareShare
ReportReport
Posted on by 12

Hello,

 

Long time reader, first time poster.

I am trying to get a count of responses, or number of columns text in them.

 

The Data Source is a SP List called MOC.

Columns are 'Authorizer #1' then 'Authorizer #1 Approves Concept'. Etc through 5 Authorizers.

 

I have a flow set up where their response will be Yes or No as a single line of text. 

 

I would like a count of number of responses for that list entry (it doesn't matter if it's yes or no) to appear in my gallery next to the status Waiting Concept Approval.

 

I have tested the below function and am getting half of them with 0, others with 68.

CountIf(MOC, ThisItem.'Authorizer #1 Approves Concept' = "Yes", ThisItem.'Authorizer #2 Approves Concept' = "Yes")

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    HI @dangm ,

    Try

    CountIf(
     MOC, 
     'Authorizer #1 Approves Concept' = "Yes" ||
     'Authorizer #2 Approves Concept' = "Yes"
    )

     

    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.

     

  • dangm Profile Picture
    12 on at

    Thanks @WarrenBelz but no success. 

    Now it's counting all "Yes" in the entire list.

     

    dangm_0-1595987145513.png

     

  • KrishnaV Profile Picture
    5,023 on at

    Hi @dangm ,

     

    If I am right your SharePoint columns are Yes/No fields, if so I request you to change them as choice fields. I have seen Yes/No fields are not a good option when you are using it with PowerApps.


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • dangm Profile Picture
    12 on at

    Hi @KrishnaV the fields are 'Single line of text', not Yes/No or Choice.

  • KrishnaV Profile Picture
    5,023 on at

    Hi @dangm ,

     

    if it is single line of text @WarrenBelz solution must work, it is a surprise to me!


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • KrishnaV Profile Picture
    5,023 on at

    Hi @dangm ,

     

    Ok a small change to @WarrenBelz proposal:

    CountIf(
     MOC, 
     'Authorizer #1 Approves Concept' = "Yes" &&
     'Authorizer #2 Approves Concept' = "Yes"
    )

    Incase you want to count both.


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

     

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    Too quick for me @KrishnaV ,

    Yes replace the Or() || with And() && 

     

  • KrishnaV Profile Picture
    5,023 on at

    Hi @WarrenBelz ,

     

    I totally agree sir all I did is change a small condition 🙂

     

    Regards,

    Krishna

  • dangm Profile Picture
    12 on at

    Unfortunately we're not having any success, @KrishnaV , @WarrenBelz .

    All of the Gallery items are showing the same number.

    dangm_0-1595992684485.png

     

    I hope I am explaining it clearly enough, I've attached a photo of how it looks in the SP List.

    The number should be the count of how many "Yes" are in one list entry/row.
    E.G. MOC ID 68 has 1 "Yes" 

  • KrishnaV Profile Picture
    5,023 on at

    Hi @dangm ,

     

    Ok now I get the issue it is not with neither Or / And condition, it is a delegation issue. CountIf is not a delegable function with SharePoint see the below article explains the functions support the delegation with SharePoint:
    https://powerapps.microsoft.com/en-us/blog/sharepoint-delegation-improvements/

     

    What are the no.of records on SharePoint list? if it is more than 2000? you need to load all the records in a collection in onStart function of the App as below:

    ClearCollect(
     colTemp,
     MySPList
    );
    If(
     CountRows(colTemp) = 2000,
     Set(
     vID,
     Max(colTemp,IDRef) //My Shadow field
     );
     Collect(
     colTemp,
     Filter(
     MySPList,
     IDRef>vID
     )
     )
    );
    If(
     CountRows(colTemp) = 4000,
     Set(
     vID,
     Max(colTemp,IDRef)
     );
     Collect(
     colTemp,
     Filter(
     MySPList,
     IDRef>vID
     )
     )
    );

    Now perform the countif on top of the collection.

     

    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard