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

Count rows in SP list based on item selected in dropdown list

Hi all,

 

I have built an app where I need to add a function which will count the number of rows hosted in SharePoint list based on a selected item from a dropdown list.

 

If for example the dropdown list has as options: 

Apple

Orange

Pear

Strawberry

 

When the user selects Apple then a function to count all the rows in Sharepoint List which have apple as selected items.

 

Could you please advice?

 

Many Thanks,

 

Anna

2 ACCEPTED SOLUTIONS

Accepted Solutions
prajyot
Resolver II
Resolver II

 

Hello,

For test purpose you can add the label on the form and assign the Text property value to
CountIf( SPList,Title=dropdownlist.selectedText) , this will show the no. of count of selectedText inside the dropdownlist.


Hope it helps.

Thanks,
Prajyot M

View solution in original post

v-xida-msft
Community Support
Community Support

Hi @anna2109 ,

Which type column do you use to store the Dropdown selected option in your SP List? Text type column or Single text column?

Do you want to count the filtered records based on the selected option within the Dropdown box?

 

1. if you use Single text column to store the Dropdown selected option:

Please take a try with the following formula (add a Label within your app, set the Text property to following😞

 

CountRows(
                   Filter('YourSPList', FilteredColumn = Dropdown1.Selected.Value)
)

 

 

2. If you use Choice type column to store the Dropdown selected option:

Please take a try with the following formula:

CountRows(
           Filter('YourSPList', FilteredColumn.Value = Dropdown1.Selected.Value)
)

If you have enabled "Allow multiple selections" option for the Choice type column, please modify above formula as below:

 

CountRows(
           Filter('YourSPList', Dropdown1.Selected.Value in Concat(FilteredColumn, Value & ";"))
)

 

In addition, if you could select multiple options within your Dropdown box (the Dropdown box may be a ComboBox control), please consider modify above formula as below:

CountRows(
           Filter('YourSPList', Concat(ComboBox1.SelectedItems, Value & ";") in Concat(FilteredColumn, Value & ";"))
)

Note: The FilteredColumn represents the column in your SP List to store Dropdown selected option.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
mdevaney
Super User
Super User

@anna2109 

I wrote something here but noticed the response of @prajyot was better.  Suggest you try their example.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

prajyot
Resolver II
Resolver II

 

Hello,

For test purpose you can add the label on the form and assign the Text property value to
CountIf( SPList,Title=dropdownlist.selectedText) , this will show the no. of count of selectedText inside the dropdownlist.


Hope it helps.

Thanks,
Prajyot M

View solution in original post

v-xida-msft
Community Support
Community Support

Hi @anna2109 ,

Which type column do you use to store the Dropdown selected option in your SP List? Text type column or Single text column?

Do you want to count the filtered records based on the selected option within the Dropdown box?

 

1. if you use Single text column to store the Dropdown selected option:

Please take a try with the following formula (add a Label within your app, set the Text property to following😞

 

CountRows(
                   Filter('YourSPList', FilteredColumn = Dropdown1.Selected.Value)
)

 

 

2. If you use Choice type column to store the Dropdown selected option:

Please take a try with the following formula:

CountRows(
           Filter('YourSPList', FilteredColumn.Value = Dropdown1.Selected.Value)
)

If you have enabled "Allow multiple selections" option for the Choice type column, please modify above formula as below:

 

CountRows(
           Filter('YourSPList', Dropdown1.Selected.Value in Concat(FilteredColumn, Value & ";"))
)

 

In addition, if you could select multiple options within your Dropdown box (the Dropdown box may be a ComboBox control), please consider modify above formula as below:

CountRows(
           Filter('YourSPList', Concat(ComboBox1.SelectedItems, Value & ";") in Concat(FilteredColumn, Value & ";"))
)

Note: The FilteredColumn represents the column in your SP List to store Dropdown selected option.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,520)