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
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
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
Top Kudoed Authors