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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
hibarrbm
Helper I
Helper I

How to create a DAX measure that references two different tables

I have a transaction fact table with just Date, Sales, and Units by WIC (product ID). Then I have a second dimension product table that contains item cost for each WIC. I want to create a measure that will lookup the item cost from the DIM table for each WIC in the Fact table without having to Merge or create a calculated column. 

 

When I merge the two tables and bring in item cost from the DIM table and create a sumx measure to calculate units * item cost, the totals are correct. However, I want to avoid merging the tables due to memory usage. Below is a screenshot of both results. Total Cost is using the merge table then the sumx measure, however, I can't get the same results without merging the tables. The results are almost double (column "Total Prod Cost $). Please help!

 

 

hibarrbm_0-1617142424514.png

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @hibarrbm 

If you have the model like below, please try similar to the below measure ( try to use RELATED function in the measure).

 

Picture1.png

 

Costs =
SUMX(FactSales, FactSales[Unit] * RELATED( DimProducts[UnitCost]))
 
The link down below is the sample pbix file that I created for this question.
 
 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @hibarrbm 

If you have the model like below, please try similar to the below measure ( try to use RELATED function in the measure).

 

Picture1.png

 

Costs =
SUMX(FactSales, FactSales[Unit] * RELATED( DimProducts[UnitCost]))
 
The link down below is the sample pbix file that I created for this question.
 
 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

It worked! Thanks again for your help!

hibarrbm
Helper I
Helper I

This is the measure i tried using to avoid merging the tables 

 

Total Prod Cost $ = CALCULATE(SUMX(Fact_Fulfilled_Sales_MarketplaceODD, Fact_Fulfilled_Sales_MarketplaceODD[UNITS] * AVERAGE(DIM_Product[Average Cost])))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.