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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
hnguyen76
Resolver II
Resolver II

DAX LeftouterJoin No Relationship

Hi All.

I'm attempting to create an attribute table from two fact tables in DAX. I'm fully aware that this is far easier and better to do in PowerQuery except that I'm using a database that has slow performance factor and the query takes forever to evaluate (even though I'm only pulling in a small amount of data). As an alternative I'd like to built this attribute table within DAX.


I want to pull just the distinct attributes from both fact tables so I can explode that within a table visual. These two facts are:

FACT_1

Ticket_IDCountryAmountSoldToSalesTypeYearMonthDateID.Key
1US100Party1Sales Order2020011-Jan-201^202001
2US102Party1Sales Order2020011-Jan-202^202001
3CAD104Party2Sales Order2020011-Jan-203^202001
4CAD500Party3Sales Order2020011-Jan-204^202001
5US5410Party1Sales Order2020011-Jan-205^202001
6CAD20Party4Sales Order2020011-Jan-206^202001
7CAD80Party3Sales Order2020011-Jan-207^202001
2US20Party1Sales Order2020011-Jan-202^202001
5US5400Party1Credit2020011-Jan-205^202001
5US400Party1Sales Order2020011-Jan-205^202001

 

FACT_2

Ticket_IDAmountApprovedCustomerYearMonthDateID.Key
11001Customer 1 Name2020011-Jan-201^202001
21020Customer 1 Name2020011-Jan-202^202001
31041Customer 2 Name2020011-Jan-203^202001
45000Customer 3 Name2020011-Jan-204^202001
554001Customer 1 Name2020011-Jan-205^202001
5101Customer 1 Name2020011-Jan-205^202001

 

Pretty common scenario.  If this is done in PowerQuery, I'd LEFTOUTERJOIN the FACT_1 ID.KEY to FACT_2 ID.KEY and return the distinct table values. This image result below is what I want:
sample_result_table.png

As such, when I add this with my bridge table I'm retrieving the values I want:
sample_result_visual.png

So my attempt at DAX does not yield the expected result:
LEFT_OUTER.png
LEFT_OUTER_TBL.png

 

Any ideas on how to proceed?

1 ACCEPTED SOLUTION

@v-juanli-msft ,
Thanks for the reply. Unfortunately I was looking for a route that did not consider using any relationships (active or inactive) while actively avoiding M-2-M. Considering performance vs data model size I opted with my original solution to use PowerQuery 

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @hnguyen76 

two ways to get expected result as you provided:

1. create relationships

Capture2.JPGCapture3.JPGCapture4.JPG

2. create inactive relationships(inactive relationships won't filter tables)

Create calcualted columns

amount2 = CALCULATE(SUM(Table2[Amount]),USERELATIONSHIP(Table1[ID.Key],Table2[ID.Key]))

customer = LOOKUPVALUE(Table2[Customer],Table2[ID.Key],Table1[ID.Key])

Capture5.JPGCapture6.JPGCapture7.JPG

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

@v-juanli-msft ,
Thanks for the reply. Unfortunately I was looking for a route that did not consider using any relationships (active or inactive) while actively avoiding M-2-M. Considering performance vs data model size I opted with my original solution to use PowerQuery 

amitchandak
Super User
Super User

You can use a cross join in Dax but it will make things slow. You can use it inside the filter to have your condition.

Also, use selectcolumns to rename and select columns as this will not Allow same name column.

 

Use summarize of top of it.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak ,

CROSSJOIN is definitely out of the question. I tried it with my dataset yesterday and it returned me 2 billion rows and took about 20 minutes to evaluate. 

I think the option you planning to use of power query is better. What you actally want to achieve using merge

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.