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 Platform Community / Forums / Power Apps / Choose items from a co...
Power Apps
Answered

Choose items from a collection when we have a minimum and maximum range

(0) ShareShare
ReportReport
Posted on by 123
Hello folks,
 
I have an collection that will have n number of records. The user will have two custom dropdowns (which is multiple of 5) to select the minimum and maximum amount of records to be selected from the collection.

Can someone explain how to choose items from a collection when we have a minimum and maximum range?
 
Thanks in advance!
Categories:
I have the same question (0)
  • Fardy_MADI_2 Profile Picture
    332 Super User 2024 Season 1 on at
     
     
    If I untenderstand your problem correctly you just have to use the formula bellow to solve this :
     
    ClearCollect( myCol_2, LastN( FirstN(myCol_1, MaxValue), MaxValue - MinValue + 1) )
     
    myCol_1 is the collection with n number of records and myCol_2 is the collection where I select the elements I want.
  • sachinsoni441 Profile Picture
    123 on at
    Hello Fardy_MADI,
     
    let me simplify question with an example 
    For example, if I have 60 items in my collection and a user chooses 5 in the first dropdown and 20 in the second, the new collection should have at least 5 and no more than 20 entries.
  • Verified answer
    timl Profile Picture
    36,715 Super User 2026 Season 1 on at
    Hi sachinsoni441,
     
    So if a user chooses 5 in the first dropdown and 20 in the second and there are fewer than 5 records in the source collection, you want to return 0 rows? If so, something like this should work.
     
    With(
      {
        MinValue: Value(DropdownMin.Selected.Value),
        MaxValue: Value(DropdownMax.Selected.Value),
        RowCount: CountRows(YourSourceCollection)
      },
      If(RowCount >= MinValue,
         ClearCollect(ResultCollection, FirstN(YourSourceCollection, MaxValue)
      )
    )
    
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard