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 Automate / Count IF - Count numbe...
Power Automate
Unanswered

Count IF - Count number of collums with "TRUE " in an Item

(0) ShareShare
ReportReport
Posted on by

I made a List with only YES or NO questions for each item.   Cant find a way to count in the number of Yes and No for each item. 

 

A count IF  in excell would work , but cant find a similar expression in flow or sharepoint

Categories:
I have the same question (0)
  • RobElliott Profile Picture
    10,391 Super User 2025 Season 2 on at

    @Anonymous you can do this with nested conditions and increment variables. In this example I've got a list of jobs and the position group that each one is in: Technical, Management or Marketing/Admin. The flow loops through each one, increments the variable for each group and then at the end sends me an email with the totals.

    The SharePoint list with Yes/No columns:

    0-SP-List.png

    I've manually triggered the flow but you could do it when a new is created or on a schedule. Next add one Initialize variable for each of your Yes/No columns, set it to Float and set the initial value to 0 or leave it blank:

    1-trigger-initvariables.png

     Next, get the items from your SharePoint list:

    2-Get.png

    Add an Apply to each control and select value from the dynamic content box. Next add a Condition to look at the first column, in this case Technical. In the If yes green channel and an Increment variable, select the variable and set the value to 1 - in other words for each item it finds where Technical is yes in the SharePoint column it will add 1 to the variable.

    Next, in the red If No channel add another condition. In my case the second condition is Management, so in the green If yes channel add an Increment variable, select the appropriate variable and set the value to 1. As this example only has 3 yes/no columns we can now just add another Increment variable for the last variable.

    3-apply-increment-technical.png

     

    4-IfNo-Condition-Increment.png

    Next, outside the apply to each, add 3 Compose controls and set the input for each to be one of the variables: 

    5-ComposeTotals.png

     Finally, add a Send an email (V2) and select the outputs of the 3 Compose controls for the relevant lines of the email. YOu could of course save the totals to a SharePoint list or do some other action, but this is just a simple email which I haven't formatted:

    6-SendEmail.png

     And this is the result:7-EmailResult.png

     If you have more than 8 columns then a different solution would be needed, probably using a switch case. But have a go with this and come back with any questions.

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

  • Community Power Platform Member Profile Picture
    on at

     HI Bob,

     

    Thanks A lot for your inputs and solution, but I want to ADD the number of YES in the Same LINE and not Collum.

     

    In your List for Example, I would it should give as a result for Accountant of  1 Yes and 2 NO. 

     

    Like I had and extra collum of totals That would give the resulto for each Line. 

     

    I also have a list with over 30 collums so It would be very though to crear a variable and a condition for each one. 

     

    I solved creating, 30 extra colluns and in each I did a formula such as If( [Collum]=YES ;  1; 0 ). And then I used the formula SUM to sum all this colluns, but as  you can imagine it was very painfull, and I would like a more simple way. Dont undestand why, there isn´t a predefinded formula such as Sumif ou countIF in sharepoint list. 

     

    So maybe in power automate there is a more cleaver solution. 

     

    Thanks again!

  • RobElliott Profile Picture
    10,391 Super User 2025 Season 2 on at

    @Anonymous sorry, I misunderstood. This can be done without using a flow in Power Automate at all, but with a Power Apps customised form on your SharePoint list.

    I've added 2 number columns to my list, CountYes and CountNo:

    0-SP-List.png

    The data fields of my customized form have been renamed to dataTechnical, dataMarketing and dataTechnica, dataCountYes and dataCountNo. In the CountYes data field I've then added the following syntax to the Default property:

    If(dataTechnical.Value=true,1,0)+If(dataManagement.Value=true,1,0)+If(dataMarketing.Value=true,1,0)

    For the dataCountNo data field it would be false of course. 

    1-customizedForm.png

    So it adds up all the Yes and No columns and when you save the form it updates it updates the list.

    CountIf.gif

    There are only 3 columns to add up in my list and yours with so many columns will take longer to produce but it will work just as well with 30+ columns

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

  • Community Power Platform Member Profile Picture
    on at

    Hi @RobElliott , 

     

    Thanks again, the issue now is that I dont have permission to use Power App.  THe best would be a sollution in Power Automate or direticlly, in sharepoint.  But I am almost accepting that it acctually is not a simple sollution.  Hopping Microsoft can improve ne amount of formulas pre developed for sharepoint list

     

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#3
David_MA Profile Picture

David_MA 270 Super User 2025 Season 2

Last 30 days Overall leaderboard