Showing results for 
Search instead for 
Did you mean: 
Helper V
Helper V

How to filter gallery using AM and PM column?

Hi all 


I am trying to filter a gallery so it displays AM and PM in sequence. I am using dataverse as my database. 


As you can see in the gallery screenshot, the AM and PM are sometimes not in sequence. Sometimes PM is before the AM but I need it to always show AM first and then PM. 


This data is generated in a flow so I just need to filter it correctly. The days are in perfect sequence so thats no issue. 


I have tried this formula: 


Search(SortByColumns(SortByColumns(Filter('Daily Measurement', 'Daily Measurement(Views)'.'Active Daily Measurement', Design.Design=GalleryHome.Selected.Design.Design),"xyy_daynumber",Ascending),"xyy_daymeasureampm",Ascending),TextSearchList_3.Text,"xyy_name")


But the error says that it 'cannot sort on expression type' and SortByColumns has some invalid arguments. But if I use another column such as the name column it can sort it with no issues. 


Thanks for any help. 

Super User
Super User



Is error for SotbyColumns on 






 If only one of the above is used, and name column, does this error occur on both of the above or only one of the above, and if so which one?

Helper V
Helper V

Hi @poweractivate  it was sorted. I used power automate to help me 

Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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