cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ttaylor
Helper III
Helper III

Filter table based on date range from two SharePoint lists

First issue:

I've created a table where I want information from the Notes SharePoint list to filter based on date range: 

     Filter(Notes, FollowUpDate >= DatePicker1.SelectedDate <= DatePicker2.SelectedDate)

THE ERROR is after the column name "FollowUpDate"

 

Second Issue:

How can I pull information from a second table. Example:

   ORGANIZATION (SP List1)      FOLLOW-UP NOTES (SP List2)   

 

the information appearing in the table would be just the two columns, based on the date range selected from the filter.

 

THANK YOU!!

1 ACCEPTED SOLUTION

Accepted Solutions

@ttaylor 

Typically the 'A column name already exists error would occur when you try to add columns that already exist.  However, we are adding the columns NZI Lead and Organization here so I am not sure why it is complaining about OrganizationNOTES.  Maybe the event that triggers to build the collection must be restarted (e.g. button click, app restart).

 

ClearCollect(
    myJoinedTables,
    AddColumns(Notes,
        "NZILead",LookUp(NetZero,Organization=Organization.Value).NZILead,
        "Organization",Organization.Value
    )
)

 

You would add the Filter by doing this.  But of course, the OrganizationNOTES problem must be solved first.

 

ClearCollect(
    Filter(
        myJoinedTables,
        AddColumns(Notes,
            "NZILead",LookUp(NetZero,Organization=Organization.Value).NZILead,
            "Organization",Organization.Value
        ),
    FollowUpDate >= DatePicker1.SelectedDate,
    FollowUpDate <= DatePicker2.SelectedDate
    )
)

View solution in original post

12 REPLIES 12
mdevaney
Super User
Super User

@ttaylor 

For issue #1 you can solve it by defining multiple criteria within the filter function

 

Filter(Notes, FollowUpDate >= DatePicker1.SelectedDate, FollowUpDate <= DatePicker2.SelectedDate)

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

mdevaney
Super User
Super User

@ttaylor 

You'll need to share more info to get a useful response for question #2

 

  • What column type is Organization in SPList1?
  • What column type is Organization in SPList2?
  • Please share sample data from both tables
  • Please share your desired result

Organization (SP1) - single-line text

OganizationNOTES (SP2) - LookUp to SP1 Organization

 

I also need it to reference a name from SP1 (NZILead) - single-line text

NZILeadNOTES - LookUp to SP1 (NZILead)

 

 

 

 

 

 

@ttaylor 

You'll need to replace your_SP1_datasource_name and your_SP2_datasource_name in the code I provided but I've tested on my sid and this should work assuming I understood your column names correctly.

 

ClearCollect(
myJoinedTables,
AddColumns(your_SP2_datasource_name,
"NZILead",LookUp(your_SP1_datasource_name,Organization=Organization.Value).NZILead,
"OrgName",Organization.Value
)
)

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

@ttaylor 

Did this resolve your issue?

I'm getting an error that says: A column named 'OrganizationNOTES' already exists. Below is what I have:

 

ClearCollect(
myJoinedTables,
AddColumns(Notes,
"NZILead",LookUp(NetZero,Organization=Organization.Value).NZILead,
"Organization",Organization.Value
)
)

 

ALSO, can I add the filter to this expression for the dates?

 

Filter(Notes, FollowUpDate >= DatePicker1.SelectedDate, FollowUpDate <= DatePicker2.SelectedDate)

@ttaylor 

Typically the 'A column name already exists error would occur when you try to add columns that already exist.  However, we are adding the columns NZI Lead and Organization here so I am not sure why it is complaining about OrganizationNOTES.  Maybe the event that triggers to build the collection must be restarted (e.g. button click, app restart).

 

ClearCollect(
    myJoinedTables,
    AddColumns(Notes,
        "NZILead",LookUp(NetZero,Organization=Organization.Value).NZILead,
        "Organization",Organization.Value
    )
)

 

You would add the Filter by doing this.  But of course, the OrganizationNOTES problem must be solved first.

 

ClearCollect(
    Filter(
        myJoinedTables,
        AddColumns(Notes,
            "NZILead",LookUp(NetZero,Organization=Organization.Value).NZILead,
            "Organization",Organization.Value
        ),
    FollowUpDate >= DatePicker1.SelectedDate,
    FollowUpDate <= DatePicker2.SelectedDate
    )
)

No luck! I tried restarting, looked at info that takes a user to that page, deleted the table and started from scratch, etc. I'm still getting the OrganizationNOTES error. That is a field in my Notes SP List the is a LookUp field to Organization in my NetZero SP list. However, the only columns pulling info from the Notes list is are KeyThemes, FollowUpDate, FollowUpNotes, MtgNotes and MtgDate.

Should have finished my thoughts...

 

I have a column in my Notes (SP2) called NZILeadNOTES that is a LookUp to NZILead in NetZero (SP1)

Then Notes (SP2) has OrganizationNOTES that is a LookUp to Organization in NetZero (SP1)

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,280)