Forum Discussion
Anonymous
1 year agoNot applicable
Column Sum * Fixed Number * Column Value
Hello, I have a column of hours worked last year per employee and am trying to create a column for associated costs for those hours worked. I know my total spend on employee wages for last year to b...
- 1 year ago
Hi Anonymous - Yes! You can make sure the Total Cost, Total Hours, and Cost of Labor all adjust dynamically to filters by modifying the formulas. Right now, your formula uses ALL('Employee Data')
Cost of Labor1 =VAR TotalHours = CALCULATE(SUM('Table'[Hours Worked]), ALLSELECTED('Table')) -- Respects slicersVAR TotalCost = 1000 -- Adjust this if needed to be dynamicVAR HourlyRate = DIVIDE(TotalCost, TotalHours, 0)
RETURN SUMX('Table', 'Table'[Hours Worked] * HourlyRate)Please find the attached pbix file. Hope this helps.
ArwaAldoud
1 year agoSuper User
You need to ensure the total cost is treated as a constant while dividing it by the total hours worked
TotalCost = 1000 // Replace with actual total spend
Cost of Labor =
VAR TotalHours = SUMX(ALL('Table'), 'Table'[Hours Worked])
RETURN
[TotalCost] / TotalHours * 'Table'[Hours Worked]
If this response was helpful, please accept it as a solution or give kudos to help other community members.