cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ianallen13V2
Helper II
Helper II

How to sort by columns twice?

Hello, 

 

I have a drop down that is connected to a SP library to pull the colleagues in our department.  I have to sort by columns in order to get it to sort alphabetically, but I also have a 'team' column, is there a way to get it to sort alphabetically and also by that specific team?  Here is the current formula: 

 

ianallen13V2_0-1637099808840.png

 

Specialist List is my SP list and "Specialist" is the name column.  I want to also have it so only colleagues under a certain team are visible instead of all colleagues.  How can I do this?

 

ianallen13V2_1-1637099887503.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
sgtsnacks
Helper I
Helper I

Hi ianallen13V2,

 

You can add multiple criteria to the SortByColumns function, as follows:

 

 

SortByColumns('Data Source',"Column Name",Ascending,"Column Name 2",Descending)

 

 

If you then want to filter out certain Teams, you could wrap the entire function in a Filter statement:

 

 

//Filter Then Sort
Filter(SortByColumns('Data Source',"Column Name",Ascending,"Column Name 2",Descending),Not("TeamName" in Team))

//Sort Then Filter
SortByColumns(Filter('Data Source',Not("TeamName" in Team)),"Column Name",Ascending,"Column Name 2",Descending)

 

View solution in original post

5 REPLIES 5
sgtsnacks
Helper I
Helper I

Hi ianallen13V2,

 

You can add multiple criteria to the SortByColumns function, as follows:

 

 

SortByColumns('Data Source',"Column Name",Ascending,"Column Name 2",Descending)

 

 

If you then want to filter out certain Teams, you could wrap the entire function in a Filter statement:

 

 

//Filter Then Sort
Filter(SortByColumns('Data Source',"Column Name",Ascending,"Column Name 2",Descending),Not("TeamName" in Team))

//Sort Then Filter
SortByColumns(Filter('Data Source',Not("TeamName" in Team)),"Column Name",Ascending,"Column Name 2",Descending)

 

StalinPonnusamy
Super User
Super User

Hi @ianallen13V2 

 

To filter the list, Do you have a separate SP list for teams and all members on that team? So that we can filter the list?

 

 

Greatly appreciate the response - for some reason when I try to add in the 'teams' column, it continues to say: "There is an error in this formula.  Try revising and running it again.  Data type: text" - this column is the same as all the others, there is no differentiation.  

 

ianallen13V2_0-1637122553680.png

 

Any thoughts?

Hi @ianallen13V2 

 

Please try this

SortByColumns(
    With(
        {Item: [@'Specialist List']},
        Filter(
            Item,
            Team <> "Evaluations Team"
        )
    ),
    "Specialist",
    Ascending,
    "Team",
    Descending
)

 


Thanks,
Stalin - Learn To Illuminate

So sorry - disregard this.  I got it figured out.  Thank you again so much for the answer! 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,483)