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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lcerrapa
Helper I
Helper I

Exclude rows on table based on another table at query design

Hello.

I don't find the answer to this question, I hope you can help me.

 

I have a query against a database that obtains data:

 

select year, projection from DimProjections where <conditions>

 

The result of this query is ALWAYS one row with this structure:

 

YEAR    PROJECTION

------   -----------------

2016    PROJECTION10

 

I have a FactSales table with many years and many projections (and many other fields), and I need to obtain all the rows except the result of the previous query (all data without 2016 year and PROJECTION10 projection combination).

 

How can I do this?

 

Thanks in advance.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Perhaps a Merge query using a Right Anti join (or Left Anti join depending on which one of your queries you consider "first".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @lcerrapa,

 

smoupre's reply seems well, perhasps you can try it.
In addition, if you use the sql database, you can directly use t-sql query to merge the table at sql statement option:

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Greg_Deckler
Super User
Super User

Perhaps a Merge query using a Right Anti join (or Left Anti join depending on which one of your queries you consider "first".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks a lot, it works perfect!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors