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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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