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

Finding Rows in SPL that are not in another SPL

Hi everybody,

 

I'm currently developing an app and having trouble with checking two SPL.

I have one SP-list "Managers" that contains users that have to complete a certain task every year.

In another list I keep track on who completed the task in the current year.

The lists look like this

"Managers"

IdName
1John
2Jane
3Steve

 

"Task_completed"

Manager_IDYear
12020
22020
32020
12021

 

Now I want to find out who did not complete the task in a certain year. For example, for the year 2020, the result should be empty, because all three managers completed their task for 2020. For 2021, the result should contain Jane and Steve, because only John did his work.

 

Is there any way to realize this using Powerapps?

1 REPLY 1
RandyHayes
Super User
Super User

@BenWishh 

Please consider the following formula:

With({_years: [2020, 2021, 2022]},
    ForAll(Managers As _manager,
        Patch(_manager, 
            {_yearsNotCompleted:
                With({_tasks: Filter(Task_completed, Manager_ID = _manager.Id)},
                    Filter(_years, !(Value in _tasks.Year))
                )
            }
        )
    )
)

This will provide a list of managers and all the years they have not completed.

 

If you are looking from it from the other perspective (a list of managers that have not completed a specified year), then consider the following formula instead:

With({_year: 2021},
    With({_items: Filter(Task_completed, Year=_year)},
        Filter(Managers, !(Id in _items.Manager_ID))
    )
)

 

NOTE: The above formulas are not using delegable criteria.  If your list is, or is expected to be, over 2000 records, then the results will not be complete.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,135)