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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

 

 

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

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.