web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SortByColumns and Filter
Power Apps
Answered

SortByColumns and Filter

(0) ShareShare
ReportReport
Posted on by 239

Hello,

 

I am working on developing an app to record employee leave and overtime. 

 

I have a gallery where the items displayed are only those belonging to a selected employee (selected from a list box control).

 

I have this formula: 

 

SortByColumns(Search(TEMPO_Leave,LBEmployeeName.Selected.Result,"Name"),"StartDate",If(SortDescending,Descending,Ascending))

 

 

Now I want to add drop downs next to the gallery where the supervisor can filter the items based on leave type or overtime type. 

 

I modified the formula to: 

 

SortByColumns(Filter(TEMPO_Leave,LBEmployeeName.Selected.Result,"Name",(LeaveType.Value=drpLeaveType.Selected.Value||drpLeaveType.SelectedText.Value=Blank())),"StartDate",If(SortDescending, Descending, Descending))

 

I am not getting any error messages, but what is happening is that the gallery displays only the selected leave type (ex: Vacation), but for ALL employees in the supervisor's team, and not just the employee who's name has been selected in the List Box control. 

I cannot understand why it stopped pulling only those from the selected employee. 

 

Can someone provide assistance on this?

 

Thank you so much! 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,007 Most Valuable Professional on at

    Hi @AuburnMist ,

    I am sure what you are doing with "Name" in there, but suspect you want this

    SortByColumns(
     Filter(
     TEMPO_Leave,
    	 Name = LBEmployeeName.Selected.Result &&
    	 (
     LeaveType.Value=drpLeaveType.Selected.Value || 
     drpLeaveType.SelectedText.Value=Blank()
     )
     ),
     "StartDate",
     If(
     SortDescending, 
     Descending, 
     Descending
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • AuburnMist Profile Picture
    239 on at

    Thank you Sir! Worked like a charm!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard