cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Sort Distinct Filter Not Sorting?

Scenario:

  • Cascading dropdowns
  • User selects option from Dropdown1
  • Dropdown2 options are filtered accordingly
  • Code for Dropdown2 Items property

 

Sort(
    Distinct(
        Filter(
            sharepoint_mapping_table,
            state = Dropdown1.Selected.Value
        ),
        area
    ),
    Ascending
)

 

Here you can see the area values are not sorting alphabetically

 

How can I fix this?

image.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Sort Distinct Filter Not Sorting?

@Pstork1 @dynamicsedge 

Sorry for the concurrent post guys.   Looks like you beat me to it.

 


@ericonline 

To me it appears you are missing the 2nd argument to Sort.

 

Sort(
    Distinct(
        Filter(
            sharepoint_mapping_table,
            state = Dropdown1.Selected.Value
        ),
        area
    ),
    Result,
    Ascending
)

 

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

5 REPLIES 5
dynamicsedge
Level 10

Re: Sort Distinct Filter Not Sorting?

@ericonline 

 

If you say Distinct(Sort) instead of Sort(Distinct) does it work?

 

But even if it does, maybe you have to do it as Sort(Distinct) - for that, we're not sure at the moment of the solution if it has to be like that.

Dual Super User
Dual Super User

Re: Sort Distinct Filter Not Sorting?

Take a look at this similar thread.  They reference a setting that can be turned off to fix the issue.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Sort-Distinct-Dropdown-Issue/m-p/170985



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Re: Sort Distinct Filter Not Sorting?

@Pstork1 @dynamicsedge 

Sorry for the concurrent post guys.   Looks like you beat me to it.

 


@ericonline 

To me it appears you are missing the 2nd argument to Sort.

 

Sort(
    Distinct(
        Filter(
            sharepoint_mapping_table,
            state = Dropdown1.Selected.Value
        ),
        area
    ),
    Result,
    Ascending
)

 

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

dynamicsedge
Level 10

Re: Sort Distinct Filter Not Sorting?

@mdevaney 

 

We noticed that it seemed odd that Sort was missing the second argument, but didn't mention it in the reply.

So it looks like you posted it first 🙂

Super User
Super User

Re: Sort Distinct Filter Not Sorting?

Thank you all for the prompt replies!

@dynamicsedge : Switching Distinct and Sort resulted in a Delegation warning and had no effect. 

@Pstork1 : I turned off Explicit Columns, no effect

@mdevaney : Added "Result" as you suggested. This worked! 
All: Very interesting how no error was thrown and the app has been working for over a year. A user just brought it to my attention that the order was wrong. 

Thank you all again!

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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