Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I have 2 tables, A and B.
I need to lookup column "ID" from table A, but only for the values of table B related column "ID2" are not null.
I would normally do a merge, only how do I handle the condition?
Thanks!
Kind regards
Valeria
Solved! Go to Solution.
Hi @ValeriaBreve ,
According to your description, you want to do a conditional merge queries. Here's my solution.
Sample data:
TableA:
TableB:
In my understanding, for null value in TableB, after merge queries with TableA, you want to return blank instead of 40(Sales for null in TableA).
Here's the original code when doing the general merge. Simply replace the three parameter in the Table.NestedJoin-"TableA" to "Table.SelectRows(#"TableA",each [ID]<>null)".
Get the correct result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ValeriaBreve ,
According to your description, you want to do a conditional merge queries. Here's my solution.
Sample data:
TableA:
TableB:
In my understanding, for null value in TableB, after merge queries with TableA, you want to return blank instead of 40(Sales for null in TableA).
Here's the original code when doing the general merge. Simply replace the three parameter in the Table.NestedJoin-"TableA" to "Table.SelectRows(#"TableA",each [ID]<>null)".
Get the correct result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks! This looks so easy... I was trying solutions that were more complicated, I did not know you could declare a subset of the table in the merge function ! So thank you so much for showing me 🙂
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
12 | |
11 | |
9 | |
6 | |
6 |