cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Order the Office365Users list

Hi I am building a powerapps for our company and I am having trouble using "Ascending" and "Descending"

Right now, I have this code that searches the users by department. It works but the employees are all over the places.
I would like to have them organized by last name. So for example, AAA. Brian should be first and AB, Ryan should be the second to appear.

 

How do I do this?

 

Thank you

If(Dropdown4.SelectedText.Value <> "All",
Filter(
    Office365Users.SearchUser(
        {
            searchTerm: "",
            top: 500
        }
    ),
    Department = Dropdown4.Selected.Value
),
Filter(
Office365Users.SearchUser(
        {
            searchTerm: "",
            top: 500
        }
    ), 
    Department <> Blank()
))
1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Order the Office365Users list

Hi @Anonymous 

 

SortByColumns(Filter(
Office365Users.SearchUser(
{
searchTerm: "",
top: 500
}
),
Department <> Blank()
),"GivenName","Surname")

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: Order the Office365Users list

Hi @Anonymous 

 

SortByColumns(Filter(
Office365Users.SearchUser(
{
searchTerm: "",
top: 500
}
),
Department <> Blank()
),"GivenName","Surname")

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

Anonymous
Not applicable

Re: Order the Office365Users list

Thank you so much Reza!

Btw, do you know how to add two different data sources to one "Gallery"?

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (5,631)