Forum Discussion
bwanRPD
6 years agoFrequent Visitor
How to divide two different values on two different tables, by the related value on both tables?
Hi,
I have two tables that each has one field in common, for example, both tables have a column containing Color (see below example).
I want to be able to, in a Matrix, sum the size of Table 1 according to color, and then divide by the number of staff in Table 2. How could I accomplish this? Thank you
- Anonymous6 years ago
Try create this measure in Table 1:Result = var sumbycolor = CALCULATE(SUM(Table1[Size]),ALLEXCEPT(Table1,Table1[Color])) var staffno = CALCULATE(SUM('Table2'[Staff]),FILTER(Table1,Table1[Color]=RELATED(Table2[Color]))) Return DIVIDE(sumbycolor,staffno)
Best,
Paul
9 Replies
- bwanRPDFrequent Visitor
Seems like I'm getting some issues with that
A yellow popup says: The syntax for ';' is incorrect.
Then when I hover over the measure it says: Unexpected expression 'calculate'
- AnonymousNot applicable
Try create this measure in Table 1:Result = var sumbycolor = CALCULATE(SUM(Table1[Size]),ALLEXCEPT(Table1,Table1[Color])) var staffno = CALCULATE(SUM('Table2'[Staff]),FILTER(Table1,Table1[Color]=RELATED(Table2[Color]))) Return DIVIDE(sumbycolor,staffno)
Best,
Paul