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 / Trying to add in a sort
Power Apps
Answered

Trying to add in a sort

(0) ShareShare
ReportReport
Posted on by 44

Hi, 

 

Getting frustrated with my syntax and hope someone can help

 

ForAll(Distinct(Filter(PDCodeCostCentreList, Title = Dropdown6.Selected.Result),'Account Code'), {Result: ThisRecord.Value})

 

I am trying to sort the account code above but when i add in a sort anywhere it wont continue working, can someone help me with the correct syntax please.

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

    Hi @IanP87 ,

    Is this what you are trying to do ?

    Sort(
     Distinct(
     Filter(
     PDCodeCostCentreList, 
     Title = Dropdown6.Selected.Result
     ),
     'Account Code'
     ), 
     Value
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Verified answer
    Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @IanP87 

     

    Try this

     

    SortByColumns(
    ForAll(
    Distinct(
    Filter(
    PDCodeCostCentreList, Title = Dropdown6.Selected.Result ),
    'Account Code'
    ),
    { Result: ThisRecord.Value } ),
    "Result",
    SortOrder.Ascending
    )

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • WarrenBelz Profile Picture
    154,393 Most Valuable Professional on at

    @IanP87 ,
    As a matter of interest it is better to get rid of the Microsoft-imposed ForAll(Distinct . . .Result) workaround syntax from all your apps when the output of Distinct (and Split) was changed from Result to Value and simply have the output of these with less code and a .Value output.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard