Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

getting max value from a gallery

(0) ShareShare
ReportReport
Posted on by

I have a gallery called 

glry_ReworkData

 

I have a label called "lbl_ID"  this has the ID for the datasource descending.

that label references a field called - OLD_RW_ID in the datasource.

What I need:  i need to reference this value

I need the value 95.2 to show in a Label. on my form. 

 

How do i get the Max value from that gallery from 

 

DAVIDPOWELL_0-1687292818505.png

 

Thanks Dave

 

  • timl Profile Picture
    34,933 Super User 2025 Season 1 on at
    Re: getting max value from a gallery

    Hi @boom_powerapps,

    It might be better for you to raise a new post as you may get a better response.

    The high level approach is to sort the data source or the gallery AllItems by the numeric column in descending order by calling the Sort function. You would then call the First function to retrieve the row and to access the associated text column.    

  • boom_powerapps Profile Picture
    101 on at
    Re: getting max value from a gallery

    @LaurensM @timl What if you want to return the MAX but also return text associated with the MAX value? For example, if Cars = 50, I see how to return the 50 but how do I return the text Cars for example?

  • Community Power Platform Member Profile Picture
    on at
    Re: getting max value from a gallery

    Thank you both very very much !!

     

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: getting max value from a gallery

    Hi @Anonymous,

     

    Try the Max() function. Below you'll find an example using the gallery name and text field or using the data source and column name:

    //Gallery + control (change to correct names)
    Max(Gallery1.AllItems, Value(Subtitle1.Text))
    
    //Data source + column name
    Max(TableName, ColumnName)

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Verified answer
    timl Profile Picture
    34,933 Super User 2025 Season 1 on at
    Re: getting max value from a gallery

    Hi @Anonymous 

    This should return the maximum value from your gallery:

     

    Max(glry_ReworkData.AllItems, 
     Value(lbl_ID.Text)
    )

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,601 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,942 Most Valuable Professional

Leaderboard