cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to create a ranking

Hi

I am currently creating an powerapp application and need the functionality to make a ranked list according to user priority.
Ex.
User1
1 topic A
2 topic B
3 topic C
4 topc D

User2
4 topic A
2 topic B
1 topic C
3 topc D

I have been trying to create it with dropdown lists and collection where I assign a value and a bool to check whether the value has been used before but with no success. A value can be assigned only one time. 

Anyone has some ideas how to solve this?

Cheers

3 REPLIES 3
Community Support Team
Community Support Team

Re: How to create a ranking

Hi @Anonymous,

 

Can you describe your requirement more clearly? Sorry but I didn't understand what you are trying to achieve. Also, what is your data source?

 

Please explain with your example, and tell what result you want to get in PowerApps.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
WillPage
Level 8

Re: How to create a ranking

You can generate a "rank" column in a collection with a formula like this:

AddColumns(
    AddColumns(
        collection,
        "numericColumnCopy",
        numericColumn
    ),
    "rank",
    CountIf(
        collection,
        numericColumn > numericColumnCopy
    ) + 1
)

To be able to evaluate the number of rows that have values smaller or larger (or indeed equal) to the same column in other records , you have to make a "copy" of it with AddColumns().

 

In this example the numeric column in the data source is called numericColumn, and the copy is numericColumnCopy.

 

Next add another column (in this case called rank) with a value of CountIf(collection, numericColumn > numericColumnCopy) +1.

 

What this is doing is counting the number of rows with a value in numericColumn that's more than the current item, then adding one. Therefore the record with the highest value in numeric column will return 0 from the CountIf. Add 1 to get the rank.

 

This formula falls down if there are duplicate values in numericColumn. It doesn't create a true rank if your data has first equal then third, for example.

Highlighted
WillPage
Level 8

Re: How to create a ranking

You can generate an "rank" column in a collection with a formula like this:

AddColumns(
    AddColumns(
        collection,
        "numericColumnCopy",
        numericColumn
    ),
    "rank",
    CountIf(
        collection,
        numericColumn > numericColumnCopy
    ) + 1
)

To be able to evaluate the number of rows that have values smaller or larger (or indeed equal) to the same column in other records , you have to make a "copy" of it with AddColumns().

 

In this example the numeric column in the data source is called numericColumn, and the copy is numericColumnCopy.

 

Next add another column (in this case called rank) with a value of CountIf(collection, numericColumn > numericColumnCopy) +1.

 

What this is doing is counting the number of rows with a value in numericColumn that's more than the current item, then adding one. Therefore the record with the highest value in numeric column will return 0 from the CountIf. Add 1 to get the rank.

 

This formula falls down if there are duplicate values in numericColumn. It doesn't create a true rank if your data has first equal then third, for example.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 266 members 4,291 guests
Please welcome our newest community members: