Forum Discussion
Calculating the SUM based on another table
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!
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+_bFinal output:
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.
2 Replies
- v-jianboli-msft
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+_bFinal output:
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.
- KruptureFrequent Visitor
Apologies about the delay. As I was offline due to personal circumstances. Will report back tomorrow