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
Highlighted
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 II
Dual Super User II

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,643)