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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Left Outer Join in Direct Query report

Hi All

I have situation where 2 tables are joined with each other with say Column1. Now I wanted to have left outer join so that all data from Table 1 reflect and only common values of Column1 reflect from Table 2.

Please note this is DirectQuery report so can not use merge queries option.

tried using NATURALLEFTOUTERJOIN as below:

RequiredComplTime = NATURALLEFTOUTERJOIN(Orders,ReqCartComplteTime)
But it failed with error below 
No common join columns detected. The join function 'NATURALLEFTOUTERJOIN' requires at-least one common join column.
 
Any thoughts please?
Thanks
 
2 ACCEPTED SOLUTIONS
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Very likely that it is your many-to-many that is causing the issue. If you read the documentation on the DAX join functions, they call out one-to-many relationships at the end of the documentation.

 

Please also note that:

  • Columns being joined on must have the same data type in both tables.

  • Only columns from the same source table (have the same lineage) are joined on. For example, Products[ProductID], WebSales[ProductdID], StoreSales[ProductdID] with many-to-one relationships between WebSales and StoreSales and the Products table based on the ProductID column, WebSales and StoreSales tables are joined on [ProductID].

  • Strict comparison semantics are used during join. There is no type coercion; for example, 1 does not equal 1.0.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

edhans
Community Champion
Community Champion

@Anonymous this is not correct. I do merges all of the time. If the tables are from different databases, you have to make a tweak to the server itself. You can create a View in DB1 to the table in DB2, then use Power Query to access both in DB1, and merges work fine, or you can create a synonym. See this StackOverflow article. Addresses both issues. Both will preserve foldling and direct query.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Very likely that it is your many-to-many that is causing the issue. If you read the documentation on the DAX join functions, they call out one-to-many relationships at the end of the documentation.

 

Please also note that:

  • Columns being joined on must have the same data type in both tables.

  • Only columns from the same source table (have the same lineage) are joined on. For example, Products[ProductID], WebSales[ProductdID], StoreSales[ProductdID] with many-to-one relationships between WebSales and StoreSales and the Products table based on the ProductID column, WebSales and StoreSales tables are joined on [ProductID].

  • Strict comparison semantics are used during join. There is no type coercion; for example, 1 does not equal 1.0.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
edhans
Community Champion
Community Champion

Hi @Anonymous - you absolutely can do a merge in Power Query. This is a Direct Query to the Contoso DW database. The SQL generated is:

 

select [$Outer].[OnlineSalesKey],
    [$Outer].[StoreKey],
    [$Outer].[ProductKey],
    [$Outer].[PromotionKey],
    [$Inner].[Store Manager]
from [DaxBook].[Sales] as [$Outer]
left outer join 
(
    select [_].[StoreKey] as [StoreKey2],
        [_].[GeographyKey] as [GeographyKey],
        [_].[Store Manager] as [Store Manager],
        [_].[Store Type] as [Store Type],
        [_].[Store Name] as [Store Name],
        [_].[Status] as [Status],
        [_].[Open Date] as [Open Date],
        [_].[Close Date] as [Close Date],
        [_].[Zip Code] as [Zip Code],
        [_].[Zip Code Extension] as [Zip Code Extension],
        [_].[Store Phone] as [Store Phone],
        [_].[StoreFax] as [StoreFax],
        [_].[Continent] as [Continent],
        [_].[City] as [City],
        [_].[State] as [State],
        [_].[CountryRegion] as [CountryRegion],
        [_].[Address Line 1] as [Address Line 1],
        [_].[Address Line 2] as [Address Line 2],
        [_].[Close Reason] as [Close Reason],
        [_].[Employees] as [Employees],
        [_].[Selling Area] as [Selling Area],
        [_].[Last Remodel Date] as [Last Remodel Date]
    from [DaxBook].[Store] as [_]
) as [$Inner] on ([$Outer].[StoreKey] = [$Inner].[StoreKey2])

 

You can see the last section does the join. The Merge dialog looks like this:

edhans_0-1594837908314.png

 

 

Definitely do the merges in Power Query. Please post back with specific issues you face.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Hi you can NOT do merge in deirect query report, as 2 queries are sourced from different databases

edhans
Community Champion
Community Champion

@Anonymous this is not correct. I do merges all of the time. If the tables are from different databases, you have to make a tweak to the server itself. You can create a View in DB1 to the table in DB2, then use Power Query to access both in DB1, and merges work fine, or you can create a synonym. See this StackOverflow article. Addresses both issues. Both will preserve foldling and direct query.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.