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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
abhiram342
Employee
Employee

Left outer join in DAX on Dimesnion and Fact

Hi all,

I have Fact and Dimension Table. I'm querying the cube using DAX code. I want to get all the values from dimension table irrespective they have value in Fact. Currenlty because 1 ( dimension) to many (fact) relationship between dimesnon and fact, I'm getting less records

EX:

Dimension

ProductIDProductName
1Cycle
2Car

Fact

DateProductIdAmount
2021-12-2012

 

final Result

ProductIDProductNameAmount
1Cycle2
2

bike

 

 

 

DAX Code: EVALUATE

SELECTCOLUMNS(

SUMMARIZE(

ProductId,ProductName,"TotalAmount",'Amount')

ProductId,

ProductName,

"TotalAmount","TotalAmount")

 

Thanks,

Abhiram

 

 

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @abhiram342 ,

 

Since you have a 1:* relationship between the Fact table and Dimension table, then to achieve a left outer join, you need to enable the option "Show items with no data" only.

 

vkkfmsft_0-1640316234202.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

5 REPLIES 5
v-kkf-msft
Community Support
Community Support

Hi @abhiram342 ,

 

Since you have a 1:* relationship between the Fact table and Dimension table, then to achieve a left outer join, you need to enable the option "Show items with no data" only.

 

vkkfmsft_0-1640316234202.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

abhiram342
Employee
Employee

Hi Vahid - Sorry , It's typo final result as below. Relationship betwen dimension and table is Star Schema 1 to many

ProductIdProductNameAmount
1Cycle2
2Car 
VahidDM
Super User
Super User

Hi @abhiram342 

 

Can you please let us know the relationship between those Fact and dimension tables? which columns and the cardinality?

 

Then how did you add Bike to the final result table?

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Hi @VahidDM  - Sorry , It's typo, final result as below. Relationship betwen dimension and table is Star Schema 1 to many

ProductIdProductNameAmount
1Cycle2
2Car 

Hi @abhiram342 

 

use this code to create a new table:

Table = 
ADDCOLUMNS (
    'Dimension',
    "Amount",
        CALCULATE (
            SUM ( 'Fact'[Amount] ),
            FILTER ( 'Fact', 'Fact'[ProductId] = EARLIER ( 'Dimension'[ProductID] ) )
        )
)

 

Output:

VahidDM_0-1640065178517.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors