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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Krupture
Frequent Visitor

Calculating the SUM based on another table

 
 
Krupture_0-1679396108712.png

 

 

Hi All,

 

I have the above tables and I would like to Calculate the sum of all back orders that can be filled where the IN SHIP stock can fill, per each x and y table. 

 

I tried the Calculate(sum(x[back orders), IN SHIP[state]="x", USERELATIONSHIP(x[title],IN SHIP[title])).

 

I think I may have to use Filter instead of userelationship, but not sure how to.

 

Could you please help?

 

Thank you!

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

Hi @Krupture ,

 

Please try:

Measure = 
var _a = CALCULATE(SUM('X State Back Orders'[Back Orders]),FILTER(ALL('X State Back Orders'),[State]=MAX('IN SHIP'[State])&&[Title]=MAX('IN SHIP'[Title])))
var _b = CALCULATE(SUM('Y State Back Orders'[Back Orders]),FILTER(ALL('Y State Back Orders'),[State]=MAX('IN SHIP'[State])&&[Title]=MAX('IN SHIP'[Title])))
return _a+_b

Final output:

vjianbolimsft_0-1679535160304.png

Best Regards,

Jianbo Li

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

2 REPLIES 2
Krupture
Frequent Visitor

Apologies about the delay. As I was offline due to personal circumstances. Will report back tomorrow

v-jianboli-msft
Community Support
Community Support

Hi @Krupture ,

 

Please try:

Measure = 
var _a = CALCULATE(SUM('X State Back Orders'[Back Orders]),FILTER(ALL('X State Back Orders'),[State]=MAX('IN SHIP'[State])&&[Title]=MAX('IN SHIP'[Title])))
var _b = CALCULATE(SUM('Y State Back Orders'[Back Orders]),FILTER(ALL('Y State Back Orders'),[State]=MAX('IN SHIP'[State])&&[Title]=MAX('IN SHIP'[Title])))
return _a+_b

Final output:

vjianbolimsft_0-1679535160304.png

Best Regards,

Jianbo Li

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

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.