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 / How to join two filters
Power Apps
Answered

How to join two filters

(0) ShareShare
ReportReport
Posted on by 1,151

Hi Guys,

 

I have two filters, one has a sort in it. how do I make one of of the following two?

 

SortByColumns(
 Filter(
 'Activity Tracker', 
 StartsWith('Created By'.Email, glbUser.Email) ), 
 "ID",
 If(SortDescending1, Descending, Ascending)
)

 

and

 

Filter(
 'Activity Tracker',
 'Date of Activity' >= DateAdd(Today(), 1 - Weekday(Today(), StartOfWeek.Sunday)),
 'Date of Activity' < DateAdd(Today(), 7 + 1 - Weekday(Today(), StartOfWeek.Sunday)))

 

J

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @jbrines 

    A quicky solution:

    With({wactivity:
     SortByColumns(
     Filter(
     'Activity Tracker', 
     StartsWith('Created By'.Email, glbUser.Email) ), 
     "ID",
     If(SortDescending1, Descending, Ascending)
     )},
     Filter(
     wactivity,
     'Date of Activity' >= DateAdd(Today(), 1 - Weekday(Today(), StartOfWeek.Sunday)),
     'Date of Activity' < DateAdd(Today(), 7 + 1 - Weekday(Today(), StartOfWeek.Sunday)))
    )
    

     

     

  • jbrines Profile Picture
    1,151 on at

    @Drrickryp Many thanks.

  • jbrines Profile Picture
    1,151 on at

    @Drrickryp 

     

    Can you help with this one, as it has a sum before the second filter?

     

    Filter('Activity Tracker', StartsWith('Created By'.Email, glbUser.Email))

     

    Join to this 

     

    Sum(Filter('Activity Tracker','Date of Activity' >= Date(Year(Today()), Month(Today()), 1) && 'Date of Activity' <= Date(Year(Today()), Month(Today()) + 1, 0)),Distance)

     

  • jbrines Profile Picture
    1,151 on at

    @Drrickryp 

     

    I have managed to put this code together but it is counting for all users in the list instead of the person who is in the list.

     

    With({wactivity:
     SortByColumns(
     Filter(
     'Activity Tracker', 
     StartsWith('Created By'.Email, glbUser.Email) ), 
     "ID",
     If(SortDescending1, Descending, Ascending)
     )},
    Sum(Filter('Activity Tracker','Date of Activity' >= Date(Year(Today()), Month(Today()), 1) && 'Date of Activity' <= Date(Year(Today()), Month(Today()) + 1, 0)),Distance)
    )

     

    The code 

    StartsWith('Created By'.Email, glbUser.Email)

     

    Makes the logged on user but it is adding up all the users.

     

    J

  • jbrines Profile Picture
    1,151 on at

    @Drrickryp Any ideas on how I resolve the issue?

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Yep.  You have substituted the original datasource, 'Activity Tracker' back into your formula instead of "wactivity", the sorted filtered temporary variable created in the With() statement. That is why you are getting all of the members instead of just the one you want.

    With({wactivity:
     SortByColumns(
     Filter(
     'Activity Tracker', 
     StartsWith('Created By'.Email, glbUser.Email) ), 
     "ID",
     If(SortDescending1, Descending, Ascending)
     )},
     Sum(Filter(wactivity,'Date of Activity' >= Date(Year(Today()), Month(Today()), 1) && 'Date of 
     Activity' <= Date(Year(Today()), Month(Today()) + 1, 0)),Distance)
    )

     Sum(Filter('Activity Tracker', 'Date of Activity' >= Date(Year(Today()), Month(Today()), 1) && 'Date of Activity' <= Date(Year(Today()), Month(Today()) + 1, 0)),Distance)

  • jbrines Profile Picture
    1,151 on at

    @Drrickryp 

     

    See error below.

     

    Filter issue 1.JPG

  • jbrines Profile Picture
    1,151 on at

    @Drrickryp Fixed it too many spaces in 'Date of Activity'

     

    Cheers

     

    J

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Smilegif.gif

     

  • jbrines Profile Picture
    1,151 on at

    @Drrickryp How would I add the weekly formula in to the one you gave for the monthly formula?

     

    Cheers

    J

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard