cancel
Showing results for
Did you mean:
Frequent Visitor

## Calculate relative position of list item

I have a list with three columns, name, group and seniority number.

Seniority number is a company assigned 4 digit number, they will not be sequential within a group.

I am trying to calculate someones relative seniority within a given group, or the whole group.

Eg: Whole list has 150 items, when the list is ordered by seniority number, you appear as list item 6, you therefore have a seniority of 6/150, or 4%. Or, filter list to Group A, of which there are 50 items, ordered by seniority number, you appear as list item 10, you therefore have a seniority of 20%.

This is possible in excel using MATCH, but this function has another use in PowerApps. Any ideas how I can achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

Just one of likely many many ways but

TMROSTER is my SPList

My Gallery Items is

``````ForAll(
Sequence(CountRows(TMROSTER)), {Sequence:Value})``````

In my gallery I can then set one of the controls to show sequence number (this will be their place in the list) and then another control to display something liek this

``Last(FirstN(Sort(TMROSTER,Title,Ascending),ThisItem.Sequence)).Title``

Mine in example is sorted by column (their name) in yours you would sort by the seniority value smallest to largest (or whichever direction gives you result you want) This will display each person in order without doing a collect first. and you can reference countrows(splist) and the thisitem.sequence for your maths

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
Super User

Just one of likely many many ways but

TMROSTER is my SPList

My Gallery Items is

``````ForAll(
Sequence(CountRows(TMROSTER)), {Sequence:Value})``````

In my gallery I can then set one of the controls to show sequence number (this will be their place in the list) and then another control to display something liek this

``Last(FirstN(Sort(TMROSTER,Title,Ascending),ThisItem.Sequence)).Title``

Mine in example is sorted by column (their name) in yours you would sort by the seniority value smallest to largest (or whichever direction gives you result you want) This will display each person in order without doing a collect first. and you can reference countrows(splist) and the thisitem.sequence for your maths

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Announcements

#### Celebrating the May Super User of the Month: Laurens Martens

@LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!

#### Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!