cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Phil_Thurner
Frequent Visitor

Filter a Table with a Column

Hey guys,

 

I have two tables. Table1 has an ID Column which looks like following for example:

Table1_ID
1
3
5
6

. Then I have a second Table2 which looks as following:

Table2_IDSizeWeight......
1............
2............
3............
4............
5............
6............
7............

.

Now i want to filter Table2 with the ID Column of Table1, the output should look like following:

Table2_IDSizeWeight......
1............
3............
5............
6............

. I would be thankful for your help.

Best regards,

Phil

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you for your help, it worked with following:

ForAll(Table2; If(ID in Table1.ID; Collect(MyCollection; ThisRecord)));;

View solution in original post

4 REPLIES 4
Adrian_Celis
Super User
Super User

Hi @Phil_Thurner 

 

You can use a collection and then add columns. Try something like this:

 

ClearCollect(MyCollection, 

AddColumns(Table1,
"Size",Lookup(Table2,Table2_ID = Table1_ID).Size,
"Weight", Lookup(Table2,Table2_ID = Table1_ID).Weight
)
)

 

Thank you for your answer. I have much more columns except from "Size" and "Weight" (these are indicated by the dots ... in the table) . Does this mean I have to write each column explizitely in the formula as you did above?

 

Isn't there a way to write it like following:

Filter(Table2, Table2.Table2_ID = Table1.Table1_ID) ?

Hi @Phil_Thurner 

 

I guess this can be another way,

Clear(MyCollection);
ForAll(Table1,
Collect(MyCollection, Lookup(Table2,Table2ID = Table1ID))
)

 

Thank you for your help, it worked with following:

ForAll(Table2; If(ID in Table1.ID; Collect(MyCollection; ThisRecord)));;

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,691)