Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Yqy
Helper I
Helper I

Filter values base on column from other Query

Query 1  Query 2
79  80
48  40
80  79
40  98
40  45
98  63
31   
null   
null   
48   
63   
45   
35   

I have two Querys, where Query 1 have extra values, and i would like to keep the "null" and the numbers from Query 2 at the sametime. The same number from Query 2 may appear more than once in Query 1, i will also need to keep all of that too. 

Please help, thanks

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Yqy 
To achieve your goal you can (in PQ ).
Duplicate your table twice:
1. For Q1 - nulls :

Ritaf1983_0-1688702347976.png

2. For Q2 no nulls

Ritaf1983_1-1688702394274.png

Then you merge inner Join Q2 no nulls with your original table:

Ritaf1983_2-1688702503475.png

After expanding, filtering out nulls from the new column, and deleting it:

Ritaf1983_3-1688702671545.pngRitaf1983_4-1688702722607.png

And last union is with a null copy:

Ritaf1983_5-1688702811241.png

them turn off the option of loading to the model those "help" tables:

Ritaf1983_6-1688702945486.png

Result:

Ritaf1983_7-1688703003551.png

Sample file here:Link to pbix 
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @Yqy 
To achieve your goal you can (in PQ ).
Duplicate your table twice:
1. For Q1 - nulls :

Ritaf1983_0-1688702347976.png

2. For Q2 no nulls

Ritaf1983_1-1688702394274.png

Then you merge inner Join Q2 no nulls with your original table:

Ritaf1983_2-1688702503475.png

After expanding, filtering out nulls from the new column, and deleting it:

Ritaf1983_3-1688702671545.pngRitaf1983_4-1688702722607.png

And last union is with a null copy:

Ritaf1983_5-1688702811241.png

them turn off the option of loading to the model those "help" tables:

Ritaf1983_6-1688702945486.png

Result:

Ritaf1983_7-1688703003551.png

Sample file here:Link to pbix 
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.