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
Anonymous
Not applicable

Referencing a table and column in SQL statement for inner join

Hi there

 

I have a HUGE dataset over 10 million rows and a small dataset of 2501 rows.

I need to do an inner join from the small to the large - so I only get matching rows from the large dataset based on Invoice ID, that way I don't bring in the entire large dataset.

 

The large dataset is called stg.vw_ActrlMthlyClaimSnapshot and Invoice ID is "Invoice ID"

The small dataset is called "OverPayments" - which I've already imported into Power BI so it's an existing table and Invoice ID is called "InvoiceId"

 

Below is my attempt at SQL but I'm not referencing the OverPayments table or Invoice ID column correctly. Help!

 

select*from stg.vw_ActrlMthlyClaimSnapshot
inner join Table.OverPayment 
on "Invoice ID" = STG.vw_ActrlMthlyClaimSnapshot.InvoiceId

 

 

 

 

 

6 REPLIES 6
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use Merge Queries, if you getting your data from SQL server it will perform Query folding.

image.png

You can check your SQL syntax by clicking on "View Native Query" 

image.png

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@Mariusz  sadly view native query is greyed out for the merge step. 

 

Basically, if I knew how to reference the OverPayment table and the InvoiceId column in a SQL statement, it should work. I've tried Table.OverPayment and that doesn't work either. 

 

I absolutely don't want to import the entire huge dataset and perform a merge within PBI. 

Hi @Anonymous 

 

Please check how you importing your tables, do you just select them from the list or do you write a sql do it?

Some of the transormations are not suported by Query Folding so its importent to make the merge before you insert any function that can not be translated to a native langage.

Please check this article and video
https://exceleratorbi.com.au/how-query-folding-works/

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

The huge table is on a SQL server, so I can use the SQL editor within Power BI to define what I want before I import it. What I want, is an inner join to an existing table within Power BI.

 

I have attempted to define an inner join, however I don't know how to reference the Power BI table called OverPayment.

 

If anyone knows how to reference a table in the SQL query editor, that would be great.


Thanks 🙂 


Anonymous
Not applicable

@Anonymous  did you ever figure out how to do this?

Mariusz
Community Champion
Community Champion

 

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.