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 / Filtering a list based...
Power Apps
Answered

Filtering a list based on values in another list

(0) ShareShare
ReportReport
Posted on by 2,235 Most Valuable Professional

Hi everyone, 

 

I am seeking help trying to filter a list of mine.

 

I have 3 related lists in dataverse: Client list / Case list / Case Client list

 

Background:

A client can have multiple cases (but only one open case at a time), and a case can have multiple clients. 

A client is created and then able to create a case for this client. 

The client list holds basic information about the client

The case list holds information about the case (E.g. Start date, end date, description, etc)

The case client list is just the client ID and case ID

 

I am needing help to filter a gallery that shows the clients list, but be able to filter by start date of a case?

 

Thanks 

Categories:
I have the same question (0)
  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    More info that hopefully makes more sense:

    AARON_C_0-1715645991502.png

     Above is the gallery I am displaying with the gallery's main item property coming from the Client list.

     

    The CA-0060 is a lookup to the CaseClient list 

     

    LookUp(CaseClientLists, ClientID.ClientID = ThisItem.ClientID).CaseID.CaseID​

     

     

    The 5/13/2024 is a lookup to the Case list

     

    LookUp(CaseLists, CaseID = Label17_7.Text).DateIssued
    \\ Where Label17_7 is 'CA-0060'​​

     

    Using the date pickers above the gallery, I would like to filter the records to only show if the date that looks up the case list is between the two date pickers.

     

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @AARON_C ,

     

    I believe you'll need to create a template table using nested AddColumns function based on the Client list and 2-level 1:N relationships:

    Filter(
     With(
     {wFilter:
     AddColumns(
     ClientList As CL, 
     caseid, 
     LookUp(
     CaseClientLists, 
     ClientID.ClientID = CL.ClientID).CaseID.CaseID​
     )
     )
     }, 
     AddColumns(
     wFilter As New, 
     Date, 
     LookUp(
     CaseLists, 
     CaseID = New.caseid
     ).DateIssued
     )
     ),
     Date >= StartDatePicker.SelectedDate && Date <= EndDatePicker.SelectedDate
    )

     

    Best regards,

  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    Hi @v-jefferni

     

    Thanks for your response. I am getting an error saying "Invalid number of arguments: received 1, expected 2" 

    Error message:

    AARON_C_0-1715663840108.png

     

    Full code:

     

     

    Filter(
     With(
     {wFilter: 
     AddColumns(
     ClientList As CL, 
     caseid, 
     LookUp(
     CaseClientLists, 
     ClientID.ClientID = CL.ClientID).CaseID.CaseID
     )
     )
     }, 
     AddColumns(
     wFilter As New, 
     Date, 
     LookUp(
     CaseLists, 
     CaseID = New.caseid
     ).DateIssued
     )
     ), 
     Date >= cmpFilterHeader_MyList.DateFrom && Date <= cmpFilterHeader_MyList.DateTo
    )

     

     

    // EDIT: One too many brackects.

    Filter(
     With(
     {wFilter: 
     AddColumns(
     ClientList As CL, 
     caseid, 
     LookUp(
     CaseClientLists, 
     ClientID.ClientID = CL.ClientID
     ).CaseID.CaseID
     )
     }, 
     AddColumns(
     wFilter As New, 
     Date, 
     LookUp(
     CaseLists, 
     CaseID = New.caseid
     ).DateIssued
     )
     ), 
     Date >= cmpFilterHeader_MyList.DateFrom && Date <= cmpFilterHeader_MyList.DateTo
    )

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 600

#2
WarrenBelz Profile Picture

WarrenBelz 478 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard