web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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 121
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)
  • Verified answer
    timl Profile Picture
    36,558 Super User 2025 Season 2 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)
      )
    )
    
     
  • sachinsoni441 Profile Picture
    121 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.
  • 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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 421

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 339 Super User 2025 Season 2

Last 30 days Overall leaderboard