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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Complex filtering (inc...
Power Apps
Answered

Complex filtering (includes search, user filter, and status filter)

(0) ShareShare
ReportReport
Posted on by 53

Hi all

I'm trying to build a complex filter that filters by user, search term, status. I can get the user and search term however the status sits on a linked sharepoint list B (i.e. the user and search terms are from sharepoint list A which pulls 'status' from B) - hope that makes sense.

 

I basically tried to use the same IF formula presented here: https://www.youtube.com/watch?v=vyBsk7-1Mxk

 

forum1.JPG

 

I am having trouble incorporating a dropdown filter list that can filter by status (which sits on another sharepoint list)

 

My formula is:

If(Dropdown1.Selected.Value = "All",

 

//below is filter if true:

Filter('Consumer Sample for Survey FINAL', StartsWith(Caller,varUserEmail), Or(StartsWith(CLIENT_FIRST_NAME, SearchBox.Text),StartsWith(ACMPS_CARE_RECIPIENT_ID, SearchBox.Text))),

 

//below is filter if false:

Filter('Consumer Sample for Survey FINAL', StartsWith(Caller,varUserEmail), Or(StartsWith(CLIENT_FIRST_NAME, SearchBox.Text),StartsWith(ACMPS_CARE_RECIPIENT_ID, SearchBox.Text)) &&

LookUp(Rep_SurveyResults, ACMPS_CARE_RECIPIENT_ID = 'Consumer Sample for Survey FINAL'.ACMPS_CARE_RECIPIENT_ID, Status).Value = Dropdown1.Selected.Value)

)

)

The text in red is the part that's giving me issues. The error is invalid argument. I understand LookUp gives a scalar result but the overall filter returns a table.

 

I'm lost as to how I can solve this. 
Does anyone have any suggestions?

Thanks in advance

Categories:
I have the same question (0)
  • AaronMoon Profile Picture
    43 on at

    Have you tried this? 
    First(Filter(Rep_SurveyResults, ACMPS_CARE_RECIPIENT_ID = 'Consumer Sample for Survey FINAL'.ACMPS_CARE_RECIPIENT_ID, Status).Value = Dropdown1.Selected.Value))

     

    Another option would be to save your filter into a collection and use AddColumns to add the status as a column. then you could filter the collection again by the status. 

    ClearCollect(colCustomerSamples, AddColumns(Filter('Consumer Sample for Survey FINAL', StartsWith(Caller,varUserEmail), Or(StartsWith(CLIENT_FIRST_NAME, SearchBox.Text),StartsWith(ACMPS_CARE_RECIPIENT_ID, SearchBox.Text)), "STATUS", LookUp(Rep_SurveyResults, ACMPS_CARE_RECIPIENT_ID = 'Consumer Sample for Survey FINAL'.ACMPS_CARE_RECIPIENT_ID, Status).Value))

    Then Filter(colCustomerSamples, STATUS = Dropdown1.Selected.Value)

  • noneother Profile Picture
    53 on at

    @AMoon thanks.

    Using First(Filter( doesn't seem to work unfortunately, it still gives invalid argument type.

    Issue with using collections is that I need to write extra formulas to write from collection to sharepoint list so it's actually more work.

  • Verified answer
    v-siky-msft Profile Picture
    on at

    Hi @noneother ,

     

    What is the Data type of ACMPS_CARE_RECIPIENT_ID column in two lists? LookUp or Text/Number?

    If they are all Text/Number type, please try this:

    Filter('Consumer Sample for Survey FINAL', StartsWith(Caller,varUserEmail), Or(StartsWith(CLIENT_FIRST_NAME, SearchBox.Text),StartsWith(ACMPS_CARE_RECIPIENT_ID, SearchBox.Text)) &&
    LookUp(Rep_SurveyResults, ACMPS_CARE_RECIPIENT_ID = 'Consumer Sample for Survey FINAL'[@ACMPS_CARE_RECIPIENT_ID]).Status.Value = Dropdown1.Selected.Value)

    OR

    Filter(AddColumns('Consumer Sample for Survey FINAL',"TheStatus", LookUp(Rep_SurveyResults, ACMPS_CARE_RECIPIENT_ID = 'Consumer Sample for Survey FINAL'[@ACMPS_CARE_RECIPIENT_ID]).Status.Value), StartsWith(Caller,varUserEmail), Or(StartsWith(CLIENT_FIRST_NAME, SearchBox.Text),StartsWith(ACMPS_CARE_RECIPIENT_ID, SearchBox.Text)) && TheStatus = Dropdown1.Selected.Value)

    Hope this helps.

    Sik 

  • AaronMoon Profile Picture
    43 on at

    Can you can hover over the error in the formula bar or look at the App Checker to see if you can get a little more information about the invalid argument type? It does seems that somewhere in your formula you have two different data types being compared. You need to first identify which formula condition is causing the problem. Then make sure that you are comparing text to text, number to number, etc. 

  • noneother Profile Picture
    53 on at
    Thanks
  • v-siky-msft Profile Picture
    on at

    Hi @noneother ,

     

    Have your issue been resolved?

    If so, please mark the answer helped you as the answer, in order to help more members find it quickly.

    Sik

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard