Hi,
Can anyone help with a formula to automatically enter a participants position in a ranking table.
I have everything figured out other than this. (don't mind the solution being for SharePoint or PowerApps).
A FireStation will submit there entry for money raised and this will total in a league table so the can compete against each other.
1 -FireStation A £300
2- FireStation B £250
3- FireStation C £100
I would like it to change the Rank ID position if FireStation C submits an entry of £300 so they would change to rank 1.
Any assistance would be great. Thanks.
Been on the forums before but never posted.
I don't have a great solution for this. Here is what I'd do.
1 - Summarize the data using groupby
Groupby --> GroupBy(DataSource, "Station", "StationSummaryName")
2) Create a gallery and in the gallery make a label summing the total sum(ThisItem.StationSummaryName,MoneyRaised).
3) Create an IF statement to rank it. It will be something like IF( Sum(Filter(DataSource, Firestation = Firestation A, MoneyRaised) > Sum(Filter(DataSource, Firestation = Firestation B, MoneyRaised), 1, etc..
Thanks for your response.
Though on this occasion a formula like that wouldn't work as there are over 100 Fire Stations and other departments involved.
You can determine the rank with the use of a timer to iterate through the sorted dataset.
The solution uses a Button and a Timer.
Button.OnSelect
Clear(colrank); //colRank are the items to display in the gallery
ClearCollect(colData, {Name:"Fire A", Raised:150}, {Name:"Fire B", Raised:250}, {Name:"Fire C", Raised:50}, {Name:"Fire D", Raised:350}); // this is my dummy data replace the colData below with your data
ClearCollect(sortedData, Sort(colData, Raised, SortOrder.Descending)); //sorting the data on the amount raised
UpdateContext({rows:CountRows(sortedData)}); // getting the number of rows
UpdateContext({count:1}); //setting the first rank
UpdateContext({calcRank:true}); //start the timer
Timer
Start = calcRank
Repeat = true
OnTimerStart
UpdateContext({r:Last(FirstN(sortedData, count))}); //get the current record (read-up on Last, FirstN functions to get a record on an index )
Collect(colrank, {rank:count, title:r.Name, raised:r.Raised}); //insert the record in the collection to display the rankings
OnTimerEnd
UpdateContext({count: count + 1}); //increment the count / rank
UpdateContext({calcRank: rows > count}); //check if your reached the last record and stop the timer.
Could also just sort the gallery by descending on the amount column, and have labels outside the gallery (thus they wouldn't move when the gallery sort changes) that line up with the rows in the gallery to indicate 1st, 2nd, etc.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
199 | |
100 | |
61 | |
59 | |
58 |
User | Count |
---|---|
254 | |
164 | |
91 | |
79 | |
70 |