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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
sivashankr
Helper II
Helper II

LEFT OUTER JOIN in Modelling (Not Merging or DAX)

Hello Team,

 

By SQL looks like below. Could you let me know how to mimic the same in Power BI Modelling. I tried with One-Many/Many-Many everything works as same as INNER JOIN. 

 

Note: I can't use the Merge feature as I have many tables as shown below.

I can't use DAX, as I have so many columns (approx. 100) in each table, as I have so many columns with same name. 

So, please let me know how we can achieve LOJ in Modelling window itself

 

SELECT * FROM TABLE1

 

LEFT OUTER JOIN TABLE2
ON TABLE1.COLUMN1 = TABLE2.COLUMN1

 

LEFT OUTER JOIN TABLE3
ON TABLE1.COLUMN1 = TABLE3.COLUMN1

 

LEFT OUTER JOIN TABLE4
ON TABLE1.COLUMN1 = TABLE4.COLUMN1

 

LEFT OUTER JOIN TABLE5
ON TABLE1.COLUMN1 = TABLE5.COLUMN1

 

1 ACCEPTED SOLUTION

Hi @sivashankr ,

 

If there are blank values in visuals, they will be hided by default. It is by design for Power BI. So, after creating relationships, you need to turn on the option "Show items with no data". 

For you situation, you could turn it on and re-publish the reports to users. Then the report will working fine. Users don't need to turn on again by themselves.

 

 

change the cross filter direction from both to singlechange the cross filter direction from both to single

v-xuding-msft_0-1598853216187.png

 

Show items with no dataShow items with no data

 

 

Best Regards,
Xue Ding
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

10 REPLIES 10
amitchandak
Super User
Super User

@sivashankr , not very clear.

But in power bi default is right join 1-M. If you add +0 to measure and view with 1 side of table it will become left join

 

measure = sum(TABLE2[value])

view by Table1[Col1]

 

others are

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak ,

Thanks much for the reply.

Here is my sample data set for 2 tables and actual output vs expected output.

I created Many-1 or 1-Many by interchanging the tables. But I still see the below output which is same as INNER JOIN.

I would like to see the highlighted records also in my output. Please note that I cant merge the tables because there so many similar tables. This should be achieved with Modelling tab only.

As per my understanding this can be achieved easily with Merge-->Left Outer Join. But I would like to know how to acieve the same in Modelling tab with cardinality

 

Untitled.png

 

Hi, it looks like inner by default in a visualization, but it's left/right you just need to allow the visualization show the blank or null results.

Try this: https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-show-items-no-data

Hope this helps,


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

Happy to help!

LaDataWeb Blog

Hello @ibarrau 

 

Thanks much for looking into this.

Originally, I created a dataset (model) and published to Service for user self-service reporting.

When I asked the users to turn-it on "Show items with no data", they questioned me "Can't we create a LOJ to pull all therecords from left table using Modelling window?"

 

So request you please let me know if there is anythng that we can do in Modeling window itself.?

Hi @sivashankr ,

 

If there are blank values in visuals, they will be hided by default. It is by design for Power BI. So, after creating relationships, you need to turn on the option "Show items with no data". 

For you situation, you could turn it on and re-publish the reports to users. Then the report will working fine. Users don't need to turn on again by themselves.

 

 

change the cross filter direction from both to singlechange the cross filter direction from both to single

v-xuding-msft_0-1598853216187.png

 

Show items with no dataShow items with no data

 

 

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

Thank you! That was very helpful!

Hello there, I am facing the same issue when I try to use a matrix visual. The visual shows the data for columns which both the joined(Relationship modeled) tables has data for. But not for columns in which only one table(Left table) has data for. Does the solution proposed by you work for matrix visual as well?

Hi, I think this is by design per the doco here:  https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-show-items-no-data#how-show-items-...

 

Particularly this part:

"It's important to note that the mechanism of selecting values for the columns is order-dependent, and can be thought of as a Left outer join operation between tables. If the order of the columns is changed, the results change as well."

 

Even if you have 'Show Items with no data' turned on, it will still hide data in columns for rows with no data on one side of the join if you don't have the columns in the right order in the table or matrix. Putting the columns from the fact table where there is data on the left side and together will mean that the data will show. If any columns from the empty table are in before that, then the data afterwards on the right won't show. 

 

I'm trying hard to find a way around it as it makes using PowerBI models with multiple fact tables as a data source for live-connect reporting very difficult. Having to explain to end users to properly understand the join and put columns in the right order - or just to remember that myself every time will be a pain. Let me know if you find a way 

THANK YOU! This solved a problem I had

Thanks @v-xuding-msft .

It worked as expected. Thank you.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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