The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi guys,
In Advance Query (Power Query) can we filter 1 table based on other table ?
For example I have table Products which has column Active (Yes/No). I have filtered this during Transform data, to Yes only.
So at Transform data as well, I want the other Table which is TransactionTable to only have ProductId that in my table Products=Active.
I can do the filter in reports of course, by select Product Id "is not blank" because obviously after put relationship between this 2 tables, it will result blank Product Id in Transactions.
But I actually don;t want this, I want at time we in Transform or in Power Query, transactions table already filtered.
I'm using Direct Query, btw
Thanks,
Solved! Go to Solution.
Hi, @admin_xlsior
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Products:
Transcation:
You may add a new step for 'Transcation' table with the following m codes,
= let
lst = Table.SelectRows(Products,each [IsActive]="Yes")[ProductID],
result = Table.SelectRows(#"Changed Type",each List.Contains(lst,[ProductID]))
in
result
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @admin_xlsior
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Products:
Transcation:
You may add a new step for 'Transcation' table with the following m codes,
= let
lst = Table.SelectRows(Products,each [IsActive]="Yes")[ProductID],
result = Table.SelectRows(#"Changed Type",each List.Contains(lst,[ProductID]))
in
result
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Awesome!
Just what I need, Thank you very much, Allan. 😇
You will need to do a combine tables with an inner join between the product table and the transaction table. I don't know if you can do this with direct query - I assume you can.