Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Count the number of times a choice appears in a sharepoint column

(0) ShareShare
ReportReport
Posted on by 691

Hello,
I have a list that looks like this:

s44_0-1645626542590.png

 

 

In a workflow, I would like to count the number of times the choice "Nantes" appears in the "Mardi" column. But I can't do that at all. Can you help me please ? 😞  Thank you in advance !

  • Community Power Platform Member Profile Picture
    on at
    Re: Count the number of times a choice appears in a sharepoint column

    Hi @RobElliott ,

    your answer for this question is great and very helpful. 

    I am working on a similar case, but the numbers have to be counted for each owner (person). Could you please

    guide me how to do it.

     

    Example of the output:

    tn101_0-1653952861098.png

     

     

    Thank you in advance.

     

    Miso101

  • Hii_iii Profile Picture
    691 on at
    Re: Count the number of times a choice appears in a sharepoint column

    Your answer is awesome! Thank you so much !

  • RobElliott Profile Picture
    10,155 Super User 2025 Season 1 on at
    Re: Count the number of times a choice appears in a sharepoint column

    @StretchFredrik your method means you have to change the flow and run it separately for each of the flow options. My method above avoids that and only needs to run once.

     

    Rob
    Los Gallardos

  • Verified answer
    RobElliott Profile Picture
    10,155 Super User 2025 Season 1 on at
    Re: Count the number of times a choice appears in a sharepoint column

    @s44 I'm sure there are several ways to do this, but the way I would do it is shown below.

    In our list we have 5 choices for Nantes and 3 each for Rheims and Paris:
    0-SP-List.png

     After the trigger, initialize a float variable for each choice:

    1-Flow.png

     

    Next, add a get items action. So that you are not bringing back any empty items adda filter query of Mardi ne null

    2-Flow.png

     

    Add an apply to each and select value from the dynamic content. Next we add a Switch which is a type of Condition that just looks at the answer to one thing. As it's a choice column select Mardi Value (not Mardi) from the dynamic content box.

     

    In a Switch you can have up to 27 "cases", for example Mardi Value equals Rheims. Inside each case box add an increment variable action, select the appropriate variable and set the amount to increment it by to 1:

     

    3-Flow.png

     

    Finally outside of the apply to each add a Compose action for each of the choices/variables and set the input to the variable.

     

    4-Flow.png

     

    The result is shown below. The flow has looped through all the items in the list where there was a choice selected, incremented the appropriate variable by 1 and then displayed the overall result in the Compose action.

     

    5-Result.png

     

    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.

  • StretchFredrik Profile Picture
    2,792 Super User 2025 Season 1 on at
    Re: Count the number of times a choice appears in a sharepoint column

    Hello,

     

    I would run a "Get objects" step to get the SharePoint list data with a filter query to only get the rows im looking for, for example: Mardi eq 'Nantes'

     

    Id then do a expression to get the amount of rows on the output from the step above: @length(body('Get_rows')?['value'])"

     

    Hopefully this is a step in the right direction for you 😊

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492