Forum Discussion

doddsb's avatar
doddsb
New Member
2 years ago
Solved

Sum Product per Column Value

Hey y'all,

 

I'm new-ish to Power BI, started a couple months ago creating reports for my workplace, and I'm struggling to represent a particular field of data. This report needs to display the goal hours and actual hours for manufacturing, the actual hours work perfectly fine as for that data source, the numbers just get summed and attributed to the correct department. The goal hours are where there's trouble, those come from a document which outlines the department, location, and manufacturing line, and what the goal hours are for each combination of those. So for example:

In the visual in Power BI, it will sum up correctly per manufacturing line, but the grand total is all wrong. I've exhausted many different formulas, but the current one I have is this:

SUM('DepartmentGoals'[Hours]) * DISTINCTCOUNT(ProductionData[SerialNum])

I see why it isn't working, per line it's fine as it'll multiply the goal number for that department and line by the count for that line and department, but for the grand total, it's adding the goal hours together (32.43 + 69.27 + 21.39 + 7.60) and then multiplying by the total count of items. I need some kind of "For each line, multiply goal hours by item count, then sum", but I'm not sure how to do that, and I've exhausted days researching and trying everything I could find and think of. We even have a Power BI expert through one of the company consultants, and working with him he's stumped too. If anyone might have any ideas or suggestions to correct this formula to get the right values and grand total, it would be super appreciated, thank you.
 
Thanks,
Brandon

2 Replies