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

Filter Table based on field in Second Table

i have two tables "Issues" and "Users" with a many-one relationship. Many on the issues table and one on the users Table, which is achieved by adding a lookup column (userid) into the issues Table. 

 

Users

Fields - userid, Name, Gender

Issues

Fields - issueId,userid,date_raised

 

i want to show the issues for only when the Gender of the user is Female. 

i tried this but i keep getting errors. any suggestions about how i can write this syntax would be appreciated

Filter(Issues, userid = Filter(users, Gender="Female").userid)

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Re: Filter Table based on field in Second Table

@Gottijay2000 

You might want to consider using the In operator for this.  Try this for your formula:

Filter(Issues, userid in Filter(users, Gender="Female").userid)

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Filter Table based on field in Second Table

Hello,

 

There are two options that can work. 

1) If you are using sql tables as your underlying data source, then you could create a view which performs the join in the CREATE VIEW definition:

SELECT u.userid, u.Name, u.Gender, i.date_raised

FROM dbo.Users u

INNER JOIN dbo.Issues i

ON u.userid=i.userid

 

2) You can perform the join within PowerApps using ShowColumns and AddColumns and then use this table result as your data source

 

ShowColumns(
    AddColumns(
        Users,
        "date_raised",
        LookUp(Issues, userid = Users[@userid], date_raised)),
    "userid", "Name", "Gender", "date_raised")

 

Hope this helps!

View solution in original post

6 REPLIES 6
Highlighted
Super User
Super User

Re: Filter Table based on field in Second Table

@Gottijay2000 

You might want to consider using the In operator for this.  Try this for your formula:

Filter(Issues, userid in Filter(users, Gender="Female").userid)

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Filter Table based on field in Second Table

Hello,

 

There are two options that can work. 

1) If you are using sql tables as your underlying data source, then you could create a view which performs the join in the CREATE VIEW definition:

SELECT u.userid, u.Name, u.Gender, i.date_raised

FROM dbo.Users u

INNER JOIN dbo.Issues i

ON u.userid=i.userid

 

2) You can perform the join within PowerApps using ShowColumns and AddColumns and then use this table result as your data source

 

ShowColumns(
    AddColumns(
        Users,
        "date_raised",
        LookUp(Issues, userid = Users[@userid], date_raised)),
    "userid", "Name", "Gender", "date_raised")

 

Hope this helps!

View solution in original post

Highlighted
Helper III
Helper III

Re: Filter Table based on field in Second Table

When i tried using the IN operator, this time i get an error with the "=" operator in the inner Filter function(ie Gender=Female"). the error say that it is an "invalid argument type"

Highlighted
Super User
Super User

Re: Filter Table based on field in Second Table

@Gottijay2000 

Check that your formula reads exactly as this:

Filter(Issues, userid in Filter(users, Gender="Female").userid)

That statement should work just fine (other than a warning for the potential for delegation errors on large data sources)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper III
Helper III

Re: Filter Table based on field in Second Table

many thanks, the gender field was actually a choice field so i changed the value from Gender to Gender.Value

Highlighted
Super User
Super User

Re: Filter Table based on field in Second Table

@Gottijay2000 

So this is a SharePoint choice column...yes, you will need the .Value

The solution you marked as your accepted solution for your question seems to indicate that you are working with SQL - perhaps you marked the wrong solution?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,979)