cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Count occurrence in SharePoint List based on 4 filters.

Hi,

I have a SharePoint List where I like to count the occurrence of several values in four different columns.

Example SharePoint List:

Name column (ColumnType)Stretcher (Yes/No)OxygenTransit (Yes/No)OxygenFlight (Choices)OxygenConnectingFlight (Choices)
 NoYes3 x ws1202 x ws120

 

No

No  
 YesNo  
 YesYes1 x ws120 
 NoYes5 x ws1203 x ws120
Totals2332

 

I like to get the totals in a variable, one for each.

 

I started with a Get Items, to get all items from the list (from last month). I now I can apply a filter in the Get Items action. But I need to apply three different filters. So I was hoping I could just do one Get Items and the apply the filter in the Initialize Variable action. I am just not really familiar with how to compose the formulas correctly.

 

So far I have this function, that counts all items and works fine:

 

 

 

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

 

 

 

Can someone please help me to extend this formula to filter by occurrences of "Yes" in the "Stretcher" column and an other formula to filter by occurrences of something (is not blank) in the "OxygenFlight" column?

 

Thank you!

 

This is what I have so far:

Filter.PNG

3 REPLIES 3
Microsoft
Microsoft

Hi @Power_Robert 

 

The Get Items action contains a filter field, you can check on the following example:

Annotation 2020-07-06 175748.jpg

You can create 3 Get Items actions and enter the filtering and then you can use the formula that you already have to get the number of occurrences in each case.

 

Best Regards

--

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions help 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!

If this post helps you give a :thumbs_up: and if it solved your issue consider Accept it as the solution

Hi @chsanche ,

Thank you.

I was aware of this option. I just thought it would be more efficient to query the data source once and then apply the filter at the variable.

 

Is there still a way to do it as described in the first post?

This is what I have now. But the part in the orange box, seems a bit overkill to me. It is all from the same data source, just a slightly different filter.

 

Isn't there a way to solve this in a formula during variable initialization? 

 

Filter.PNG

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (19,340)