cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Highlight Minimum Value or have multiple sort conditions

Hello,

 

I am working in powers apps and have a column where I would like to have the minimum value highlighted in a different color to direct that user to update the lowest value next.  If this cannot be done, or you are ambitious and know the answer to both.  Is there a way to sort multiple columns at once?  I already have a sort feature to sort my column titled "Tally" by descending which works great but then I would need to add my "total" column to sort ascending so the lowest number is on top.

 

Any help would be appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Highlight Minimum Value or have multiple sort conditions

@kw8 

I missed the FIRST function in my code.  Try this...

If(ThisItem.Total=First(Sort(your_sharepoint_list, Total, Ascending)).Total,Red,Black)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

10 REPLIES 10
Highlighted
Super User
Super User

Re: Highlight Minimum Value or have multiple sort conditions

@kw8 
I am finding it hard to visualize what your app does and what it looks like.  A screenshot would be helpful here so I could understand exactly what you need to highlight.

Highlighted
Regular Visitor

Re: Highlight Minimum Value or have multiple sort conditions

@mdevaney 

 

Hello,

 

Attached is a screenshot of the app.  My hope is to have the lowest value in the Total column (connected to Sharepoint List) highlight if displaymode is edit.  In the attached example it would highlight the #5 in the total column because it is the lowest value in the column that has displaymode edit.

 

If that cannot be done, is there a way to add to the sort I have listed below?  Currently this sorts those that are "off tally" and puts them to the bottom.  Is there a way to keep that sort and that add an additional sort feature to then have it sort Total from lowest to highest?

 

Sort('Group Health CPAP',Tally, Descending)

 

Thank you for your help!

 
Highlighted
Super User
Super User

Re: Highlight Minimum Value or have multiple sort conditions

@kw8 

Please try this code in the the Color property of your label showing the total.

If(ThisItem.Total=Min(your_sharepoint_list, Total),Red,Black)


---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Regular Visitor

Re: Highlight Minimum Value or have multiple sort conditions

@mdevaney 

 

I'm sorry but that does not work.  When the formula is entered it still does not recognize the minimum value.  Instead I get a delegations warning stating the "Min" operation is not supported by this connector.

Highlighted
Super User
Super User

Re: Highlight Minimum Value or have multiple sort conditions

@kw8 

Don't you just love delegation? LOL.  Here's a delegation-friendly approach (assuming total is a number type column in SP).

If(ThisItem.Total=Sort(your_sharepoint_list, Total, Ascending).Total,Red,Black)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Regular Visitor

Re: Highlight Minimum Value or have multiple sort conditions

@mdevaney 

 

LOL yes, delegations are so fun!  I feel like you are close but its still not working properly.  The = sign between Total and Sort is throwing an invalid argument type error.  I tried to update it but am not having any luck.  I'm sorry!  When I posted this I thought it had to be something so simple that I was just missing but now I'm not so sure 🙂

 

  

Highlighted
Super User
Super User

Re: Highlight Minimum Value or have multiple sort conditions

@kw8 

I missed the FIRST function in my code.  Try this...

If(ThisItem.Total=First(Sort(your_sharepoint_list, Total, Ascending)).Total,Red,Black)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
Regular Visitor

Re: Highlight Minimum Value or have multiple sort conditions

@mdevaney 

 

That worked!  Thank you for hanging in there with me, I really appreciate the help!

Highlighted
Regular Visitor

Re: Highlight Minimum Value or have multiple sort conditions

@mdevaney 

 

I'm sorry I have one more question!    Is there a way to add an Iferror, and && so the formula  would only apply to items that have displaymode turned on?  For example, In my app if the checkbox in column 1 "Tally" is marked "no" I have it set to disable the displaymode for all of adjacent fields.  I would want the formula to go over that row and highlight the next lowest value.

 

I tried the below but it doesn't skip that row all together, it just doesn't highlight anything if it is the lowest value.

If(ThisItem.Tally = true && ThisItem.Total=First(Sort('Group Health CPAP', Total, Ascending)).Total,Red,White)

 

Screenshots below.  In the second screenshot, because the Tally column is marked no/false, it would then highlight the next lowest?


This might be a lofty ask!  If so, what you created will still work, this would just be icing on the cake!

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,600)