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
Anonymous
Not applicable

Need help on calculate a measure from 2 different tables

Hi,

I have table like below:

 

Table1:

M1M2P1P2Stock
zzzzzzJapanC234501/05/201955
zzzzzzJapanC234501/06/201920
zzzzzzJapanC234501/07/201945
zzzzzzJapanC234501/08/201924
zzzzzzIndiaC234501/05/201912
zzzzzzIndiaC234501/06/20190
zzzzzzIndiaC234501/07/201967
zzzzzzIndiaC234501/08/201999

 

Table2 :

M1M2P1P2Sales
zzzzzzJapanC234501/05/201910
zzzzzzJapanC234501/06/20190
zzzzzzJapanC234501/07/201921
zzzzzzJapanC234501/08/201911
zzzzzzIndiaC234501/05/20192
zzzzzzIndiaC234501/06/20190
zzzzzzIndiaC234501/07/20199
zzzzzzIndiaC234501/08/201933

 

in above 2 tables, columns M1,M2,P1,P2 values are almost same, so I want to calculate new calc measure from these 2 tables like below:

 

   JanuaryFebrauaryMarchAprilMayJuneJulyAugestSeptemperOctoberNovemberDecember
zzzzzzJapanC23450000452024130000
zzzzzzIndiaC2345000010058660000

 for the data available months, it should calculate a new measure = stock - sales.

 

I tried to achoeve using the RELATED function is not worked. excep data columns all other columns are same in both the tables can anyone suggest the way to relate those tables and calculate the new measures.

 

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous ,

I'd like to suggest you create a calculated column to concatenate multiple fields, then you can create a table to extract two table concatenate column values and use it as bridge to link two tables:

Relationship in Power BI with Multiple Columns 

After these, you can simply create measure to get correspond stock amount and sales amount for calculating.

 

measure =
SUM ( table1[stock] ) - SUM ( table2[sales] )

 

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

HI @Anonymous ,

I'd like to suggest you create a calculated column to concatenate multiple fields, then you can create a table to extract two table concatenate column values and use it as bridge to link two tables:

Relationship in Power BI with Multiple Columns 

After these, you can simply create measure to get correspond stock amount and sales amount for calculating.

 

measure =
SUM ( table1[stock] ) - SUM ( table2[sales] )

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Thank you so much Xiaoxin.  Its worked now.

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can create dimensions like in the article below.

https://radacad.com/basics-of-modeling-in-power-bi-what-is-a-dimension-table-and-why-say-no-to-a-single-big-table

And create relationships between newly created dimensions and Both of your (fact) tables.

 

This will allow you to yous dimension tables in your report and propagate filters to both tables at the same time.

 

Another option would be using a TREATAS() DAX expression in one of the Measures

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors