web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Get max value in list ...
Power Apps
Unanswered

Get max value in list from selected item

(0) ShareShare
ReportReport
Posted on by 4

Hello to the community,

 

I need to get the max value from a SharePoint list.

From the form, a drop-down list provides the items to select. The selected item result should be MAX() lookup value from a specific column.

I have tried multiple variations of filters, lookups and sort without success. Any assistance will be appreciated. 

First('SPList').column - produces perfectly the value but without the lookup reference. 

I believe that I have to filter on the drop-down list selected item and search for my last entry on that column. However, I'm embarrass to say that I can't seem to get the syntax correct.

 

This produces an invalid argument type-

First(SortByColumns(Filter('SPList', List=Dropdown1.Selected.Value), Column1, Descending)).Column1

 

Thanks.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @Marcthepunk ,

    Are you looking for the Maximum of Column1 (I assume it is a Numeric field)

    Max(
     Filter(
     'SPList', 
     List=Dropdown1.Selected.Value, 
     Column1
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Verified answer
    v-yutliu-msft Profile Picture
    on at

    Hi @Marcthepunk ,

    Three problems on your original formula:
    1)you need to add "" besides your column name.

    2)Column1's data type 

    3)Could you filter function get right result: Filter('SPList', List=Dropdown1.Selected.Value)

    If your filter function also has problem, please tell me the data type of list field and the drop down's Items.

    I assume that Column1 is number type and the filter function is right, then you just need to make a little change:

    First(SortByColumns(Filter('SPList', List=Dropdown1.Selected.Value), "Column1", Descending)).Column1

     

     

    Here's a doc about sortbycolumns function for your reference:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort

     

     

    Best regards,

  • Marcthepunk Profile Picture
    4 on at

    Thanks for the reply.

     

    The syntax is finally correct with the double-quotes on the column name. However I had to use SharePoint's "true" column naming because of a space in the column title.

     

    First(SortByColumns(Filter('SPList', List=Dropdown1.Selected.Value), "Column1", Descending)).Column1

     

    The query is not returning any records though and I believe it has to do with my drop-down list. I did indeed tested the filter query on another column and it works. The thing is that my drop-down list is coming from a SharePoint list lookup (Text) column. This could be the reason why its not returning any records. Any ideas around this? Or do I have to alter/recreate the drop-down list lookup values?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard