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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter and Sort PowerApps
Power Apps
Answered

Filter and Sort PowerApps

(0) ShareShare
ReportReport
Posted on by 13

Hi! 

I'm new in the PowerApps world... and I'm having some difficulties with sort and filter function. 

I want to obtain the maxium value from the field "Ordem" (in a textinput), from a table, where the field "UO" it's equal to the value from a dropdown table. 

I tried the following expression: 

Spoiler (Highlight to read)
Last(Sort(Filter(tblNewOportunidades,UO=DataCardValue.Selected),Ordem,Ascending).Ordem
Last(Sort(Filter(tblNewOportunidades,UO=DataCardValue.Selected),Ordem,Ascending).Ordem

Can someone help me to find where is my mistake? 

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @e351445 

    You can find the maximum value by using the MAX function on a Table

     

    Max(
     Filter(tblNewOportunidades,UO=DataCardValue.Selected),
     Ordem
    )

     

    You might also want to try this slightly different code if the first solution doesn't work

    Max(
     Filter(tblNewOportunidades,UO=DataCardValue.Selected.Value),
     Ordem
    )

    ---
    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."

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    @e351445 

    Is there any error message on the formula? could you show the screenshots?

    It seems you are missing a ")", please try this:

    Last(Sort(Filter(tblNewOportunidades,UO=DataCardValue.Selected),Ordem,Ascending)).Ordem

    Sik

  • e351445 Profile Picture
    13 on at

    Hi! 

    Thank you so much for your reply! 

    When I tried your solution, I got this warning: 

    "Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The "Max" operation is not supported by this connector. 
    This rule creates a circular reference between proprieties, which is not allowed. A property cannot reference itself or ther properties affected by its value."

    I'm still working with a database that only has like 5/10 records. 

  • e351445 Profile Picture
    13 on at

    Hi! 

    Thank you so much for your reply! 

    I tried your solution, I a got this warning: 

    "Delegation warning. The "Sort" part of this formula might not work correctly on large data sets."

    I'm working with a database that only has like 5/10 records. 

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    @e351445 

    Wich kind of data source you are connecting?

    Please try this workaround, using Gallery.AllItems to avoid delegation error.

    1. Add a gallery to display all sorted and filtered records of tblNewOportunidades, set Items property of gallery as below:

    Sort(Filter(tblNewOportunidades,UO=DataCardValue.Selected),Ordem,Ascending)

    2. set Default property of TextInput box:

    Last(Gallery.AllItems).Ordem

    Note: if there is no need to display the gallery, just set the visible property to false.

    delegation threshold is 4delegation threshold is 4

    Sik

     

  • e351445 Profile Picture
    13 on at

    Hi, @v-siky-msft!

    This solution worked really well!

    Thank you! 😃

  • mdevaney Profile Picture
    29,993 Moderator on at
    @e351445
    The delegation warning can be safely ignored if your list has less than 2,000 items

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard