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
Solution Supplier
Solution Supplier

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)));;

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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