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 / Create Rank number of ...
Power Apps
Answered

Create Rank number of each item in collection when collection is created

(0) ShareShare
ReportReport
Posted on by 13

Hi, 

 

I'm looking for some help with patching a rank number to a collection when it is created. The collection will already have a column named rank to add to it. The first item should be the number 1 and should increment through by 1. The code I have below so far initially creates the collection. 

 

 

With(
 {
 StartDate: Date(
 Year(cmb_ChooseMonth.Selected.Value),
 Month(cmb_ChooseMonth.Selected.Value),
 1
 ),
 EndDate: Date(
 Year(cmb_ChooseMonth.Selected.Value),
 Month(cmb_ChooseMonth.Selected.Value) + 1,
 1
 ) - 1
 },
 ClearCollect(
 colMonthReview,
 Filter(
 EOTMSPNominations,
 Created >= StartDate
 ,
 Created <= EndDate
 )
 )
);

 

Categories:
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Bolas ,

     

    Would you like to add an increment ID column to the collection colMonthReview?

     

    If so, please try below formula:

    ForAll(Sequence(CountRows(colMonthReview),1),Collect(colMonthReview2,AddColumns(Last(FirstN(colMonthReview,Value)),Rank,Value)))

     

    Best regards,

  • Verified answer
    WarrenBelz Profile Picture
    156,750 Most Valuable Professional on at

    Hi @Bolas

    Try this

    With(
     {
     StartDate: 
     Date(
     Year(cmb_ChooseMonth.Selected.Value),
     Month(cmb_ChooseMonth.Selected.Value),
     1
     ),
     EndDate: 
     Date(
     Year(cmb_ChooseMonth.Selected.Value),
     Month(cmb_ChooseMonth.Selected.Value) + 1,
     1
     ) - 1
     },
     With(
     {
     _Review:
     Filter(
     EOTMSPNominations,
     Created >= StartDate,
     Created <= EndDate
     )
     },
     ClearCollect(
     colMonthReview,
     ForAll(
     Sequence(CountRows(_Review)),
     Patch(
     Index(
     _Review,
     Value
     ),
     {Rank: Value}
     )
     )
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Bolas Profile Picture
    13 on at

    Thanks. Is it necessary to create a 2nd collection or can i just addcolumn to comMonthReview?

  • WarrenBelz Profile Picture
    156,750 Most Valuable Professional on at

    Hi @Bolas ,

    You only need the one collection - colMonthReview which should be produced with what I posted.

  • Bolas Profile Picture
    13 on at

    Thanks. I have used your code. Appreciated 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard