cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TechNewbie
Frequent Visitor

GROUP BY, SORTBYCOLUMNS, DISTINCT, FILTER

Hi, Just wanted to ask if it is possible to combine GROUP BY, SORTBYCOLUMNS, DISTINCT and FILTER in a single statement. 

Thank you!

4 REPLIES 4
timl
Super User
Super User

Hi @TechNewbie 

Technically, there's no reason why you can't combine all of those in a single statement.

If you're working with a remote data source like SharePoint/SQL Server, the resulting formula will most likely not be delegable. This means that with larger recordsets, the result may not include all your intended results.

TechNewbie
Frequent Visitor

Hi @timl, Thanks! Got it. So that is the caveat in using it all at once. 

 

The data is stored in a SharePoint list.

SampleColumn.PNG

I would like to filter the rooms. Remove all rooms that are already Occupied then show only available room timeslots for booking. Can you advise the best approach for my dilemma? Thank you!

 

ScreenShot.PNG

Hi @TechNewbie ,

Could you please share a bit more about your scenario?

Do you want to show only available room timeslots for booking for a selected Room in your Gallery?

Do you add another list to list all avaialble timeslots records?

Further, could you please share more details about the formula you typed within the Rooms Gallery?

 

I assume that you add another list to list all available timeslots records for each ROOM, is it true? Based on the needs that you mentioned, please consider take a try with the following workaround:

Set the Items property of the Timeslots Gallery to following formula:

Filter(
          'Your Timeslots List',
           Not(
Text(TimeslotsColumn) in Concat(Filter(RoomDetails, Room_Name = Gallery_SelectRoom_2.Selected.Result), StartTime & ";")
) )

Note: The TimeslotsColumn represents the column in your 'Your Timeslots List' to store the timeslots value, e.g. 7:00:00 AM, 7:30:00 AM, ...  3:00:00 PM, 3:30:00 PN, ...

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @TechNewbie 

If I understand you correctly, I think you can accomplish this without needing to combine all of those functions into a single formula.

Using the screen layout that you already have, you can just filter your gallery controls and cross reference the other screen controls where appropriate.

From a high level, the approach would look something like this. Hope that makes sense.

 

 

 

image.png

 

Helpful resources

Announcements
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 (3,574)