cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RickPeaugh
New Member

SortByColumns with custom sort in Filter does not work in DataTable

I have a DataTable with the following function in Items:

 

SortByColumns(
Filter(Eng_Apps_1, OS = Gallery1.Selected.'Operating System'),
"Application", Ascending, "Application Environment", Ascending)

 

The above works, but what I want is:

 

SortByColumns(
Filter(Eng_Apps_1, OS = Gallery1.Selected.'Operating System'),
"Application", Ascending, "Application Environment", ["Dev", "Staging", "Prod"])

 

And PowerApps says there is an error in the formula.  Can this be fixed or is there a workaround?

1 ACCEPTED SOLUTION

Accepted Solutions
rubin_boer
Super User
Super User

 @RickPeaugh may i suggest you add another column to your datasource and filet it by that column

SortByColumns(
AddColumns(
Filter(Eng_Apps_1, OS = Gallery1.Selected.'Operating System'),"AppEnvId",
Switch(true, "Application Environment" = "Dev", 1, "Application Environment" = "Staging", 2 ,3
),
"Application", Ascending, "AppEnvId", Ascending)

 

hope it helps

View solution in original post

2 REPLIES 2
rubin_boer
Super User
Super User

 @RickPeaugh may i suggest you add another column to your datasource and filet it by that column

SortByColumns(
AddColumns(
Filter(Eng_Apps_1, OS = Gallery1.Selected.'Operating System'),"AppEnvId",
Switch(true, "Application Environment" = "Dev", 1, "Application Environment" = "Staging", 2 ,3
),
"Application", Ascending, "AppEnvId", Ascending)

 

hope it helps

View solution in original post

Ok.  That works. 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,223)