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
juanjosegarrido
Regular Visitor

SUMX with multiple tables

Dear Community,

There is a formula I have been looking for and can''t figure it out. I have several tables in my model for Projects, Contracts and percentage progress as planned and real progress. 

Formula I am looking for X = Amount(%RealProgress - %PlannedProgress). Formula X contains 3 fields, each of them in a different table.

I have been trying things like creating a measures with Sumx, Related and RelatedTable like example below with no luck.

 CALCULATE(SUMX(RELATEDTABLE(tblRealProgress);tblRealProgress[Progress]*RELATED(tblContracts[Amount])) - 

                     SUMX(RELATEDTABLE(tblContracts);tblContracts[Amount])*SUM(tblPlannedProgress[Progress])) 

Data model in image below.Capture.PNG

 

 

 

Any ideas are very much appreciated.

 

Regards.

3 REPLIES 3
v-sihou-msft
Microsoft Employee
Microsoft Employee

@juanjosegarrido

 

In this scenario, your Amount can map RealProgress properly. However, your Project has 1 to many relationship to plannedProgress, which means your Amount can never get a specific corresponding PlannedProgress. This is the reason why your formula can't work.

 

Regards,

Hi, thanks for your reply. Because there are more than one contract value, what would be a correct change in my data model?

Maybe moving contract amount to Projects table?

 

Regards.

v-sihou-msft
Microsoft Employee
Microsoft Employee

@juanjosegarrido

 

In this scenario, your Amount can map RealProgress properly. However, your Project has 1 to many relationship to plannedProgress, which means your Amount can never get a specific corresponding PlannedProgress. This is the reason why your formula can't work.

 

Regards,

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.