'Avoid double counting in Power BI sum
I'm trying to count the number of factory operators used to manufacture parts during a shift but I am double counting them as this example illustrates:
Machine Groups
Group A : Machines 1 and 2, employing 3 operators per shift
Group B : Machines 3 and 4, employing 2 operators per shift
Shift Output
| Group | Machine | Operators | Item | Quantity |
|---|---|---|---|---|
| Grp A | Mach 1 | 3 | Nuts | 1000 |
| Grp A | Mach 2 | 3 | Bolts | 500 |
| Grp B | Mach 3 | 2 | Washers | 2000 |
| Grp B | Mach 4 | 2 | Springs | 1500 |
| Total | 10 | 5000 |
So the total quantity of parts is correct but the total number of operators is incorrect as it should only be 5. Operators are being double-counted because they make 2 different parts.
I have tried using an implicit sum on the operators column and also a DAX sum
- Sum Operators = SUM(Production(Operators))
I have also tried with a matrix rather than a simple table but get the same result.
(There will not always be 2 items per shift. There could sometimes be 3 or 4)
Solution 1:[1]
If I understand you correctly, you can
- click the down arrow on the Operators Values line.
- Select to create a new quick measure
- Average (or Min or Max since they would all be the same) by Group
Then you can delete the original Operators entry and rename this new one.
Note: I am very new with this so there may be more efficient methods to do this
Solution 2:[2]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ron Rosenfeld |
| Solution 2 | Yonah |


