cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tejapowerbi123
Helper IV
Helper IV

Opposite of filter in Power Query (ONLY MATCHING RECORDS AND OTHER RECORDS NEEDS TO KEEP)

Hello Community,
I am looking for help for the below scenarios; I want to achieve in Power Query.
I want to keep or remove rows based on the "Lookup Table." values.
***Requirements
If the lookup table's "fiscal product" column value is available in any of the three tables, I want to keep that value. Otherwise, I want to filter out nonmatching values from tables.

communityfinal123.PNG


1 ACCEPTED SOLUTION
lbendlin
Super User III
Super User III

Did you know that you can merge on multiple columns?  Do a left anti join between your fact tables and the reference table based on all original key columns.

 

Fact table:
Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlHSUUpUitWBsJLALFO4mClELBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [year = _t, product = _t])

Exclusion table:
Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlXSUUpUio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [year = _t, product = _t])

Result table:
Table.NestedJoin(Fact, {"year", "product"}, Exclusion, {"year", "product"}, "Exclusion", JoinKind.LeftAnti)

View solution in original post

3 REPLIES 3
lbendlin
Super User III
Super User III

Did you know that you can merge on multiple columns?  Do a left anti join between your fact tables and the reference table based on all original key columns.

 

Fact table:
Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlHSUUpUitWBsJLALFO4mClELBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [year = _t, product = _t])

Exclusion table:
Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlXSUUpUio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [year = _t, product = _t])

Result table:
Table.NestedJoin(Fact, {"year", "product"}, Exclusion, {"year", "product"}, "Exclusion", JoinKind.LeftAnti)

View solution in original post

lbendlin
Super User III
Super User III

please state your question again, "i want to filter out nonmatching values from tables" is not clear.

Thank you so much for attending to my questions @lbendlin 
[please state your question again, "I want to filter out nonmatching values from tables" is not clear.]
Sunday_EST.png
***If values match the lookup table "final product" column; then I want to keep that row—otherwise, I want to filter out that rows.Example: If Fiscal 04, I want to filter(remove that rows) the final product value (5-ABC), but if Fiscal 05, then (5-ABC) should stay.Let me know if you need more information.

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors