cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Power Participant
Power Participant

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.

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

Highlighted
Power Participant
Power Participant

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

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