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 Automate
Answered

Count occurences

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi there, 

I am in a bit of a pickle, i have a sharepoint list with a bunch of names in it, i now want to move these to an excel sheet with flow this is relatively easy. In my sharepoint list is the columns Name and Number, where the input to the table in excel  would correspond to these. However I have made a third column in my excel sheet in this i want to count the number of occurences of each name. 

What i am doing rightnow is using this expression in flow,

 

'length(body('Hent_elementer')?['value'])'

 

however this counts all of the values that have been imported, my question is whether there is a way for me to filter this so that it only counts specific names, 
so that if "Sophie" is there twice it counts 2 and if "Jack" is there once it counts 1 etc. 🙂 

Hope you can help 
Best Wishes Tobi 🙂 

 
Categories:
  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Anonymous 

     

    This is a rather complex/ long flow that I have. There might be easier and better ways too. Now that you already moved all the sharepoint items to excel, you can use :

    First get items from sharepoint and create an array variable. Append the title (name) to this array variable and check if the curent list item exists in it. This way you can get all the unique names in the array. 

    comp1.PNG

    Now for each name in the array, list rows in excel table use the filter query and then based on that update all these rows with the count using the expression: 

    length(body('List_rows_present_in_a_table')?['value'])

     

    Comp2.PNG

    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!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

     

    hi @yashag2255 
    Thanks for the great response, the issue that i am having at this moment is that althoug this seems like a valuable way of achieving this, the flow(although it says it runs to completion) doesn't actually update the rows?? Is this something you have seen before? 🙂 

    Update row.PNG

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Anonymous 

     

    Looks like the List rows in an excel is not returning anything. Can you please expand and share a screesnhot of that? 

     

    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!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Of course 🙂 

    2509191.PNG

     

    2509192.PNG

     

    2509193.PNG

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @yashag2255   ^^ forgot to tag you 

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Anonymous 

     

    In the filter query can you add single quotes for the current item in the List rows action? (type ' select the current item and then type ')

     

    Also, in teh run history, can you check the array is getting populated or not?

     

    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!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @yashag2255 

    Just tried it

    Same issue, It still does "work" it just does not add/update the row that it should. 

    The array is getting populated, however it only populates the first time the "subject" occurs meaning that as an example 

    it populates the first time the name "John Lennon" is located by the flow. However, the next time this name occurs instead of populating it reads ActionBranchingConditionNotSatisfied , and says that it skipped this. 

    But in my mind that is correct, it should only store the same value once, and then later on count the number of occurences of set value? 


  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Anonymous 

     

    Yep. That is how it should work. Now can you check if there are any items being returned in the Get items action? Did you add the single quotes '' to wrap the curent item in the filter query expression? Also, can you check if you are using the correct name of the column in the filter query? 

     

    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!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @yashag2255 

    Items are definately being returned in the Get Items action, as it pulls thedata and adds these to an excel sheet. 
    Yes i used single qutoes 🙂 

    I am fairly certain it is the correct one, however i will check the two others, how do you use one that is multiple words withspaces between, so one is "total price" however, putting it in like this will result in a syntax error, is it not possible to use column names with spaces in them? 🙂 

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Anonymous 

     

    Can you check if there are items being returned in the List rows action? (where you have the filter query?)

     

    If there are spaces in the column name, you can do this total_x0020_price eq ''. 

     

    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!

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 Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 430

#2
11manish Profile Picture

11manish 341 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 282

Last 30 days Overall leaderboard