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

Collection: Counting Products from Category?

I want to build a quote tool. I will use a collection called colSelectedProducts. I want to prohibit users from adding too many products from certain categories. 



ClearCollect( colSelectedProducts, { Item: "Denim Jeans", Category: "Pants", Quantity: 2 }, { Item: "Rolex Watch", Category: "Watch", Quantity: 1 })



I'll have a table with {Category: "Jeans",Limit: 5}.{Category:"Watch",Limit:1} to set the limitations per category.


How do count the products in the colSelectedProducts Collection to make sure that there aren't, for example, 2 watches?

Resolver IV
Resolver IV

Hi @oguruma ,

The solution might be the CountRows() function:

CountRows(Filter(colSelectedProducts, Category="Watch"))

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,517)