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 8

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 8

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 🙂

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

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,163)