Forum Discussion
Column Sum * Fixed Number * Column Value
- 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.
Hi Anonymous -create a calculated column as below:
rajendraongole1 & ArwaAldoud both of your solutions look like they work! Initially it didn't look correct because I had filters applied and the numbers were off as a result.
That is my next question though. I need to filter the page with a few slicers and have the TotalCost, TotalHours, etc... all filtered by the same slicers. Is this possible?
Right now what's happening is that the $1,000 total cost is being divided by ALL values, even if I've filtered the view. I'd like the $1,000 to be divided by what's shown on the screen.
- rajendraongole11 year agoSuper User
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.
- Anonymous1 year agoNot applicable
rajendraongole1 this is perfect, thank you!
- ArwaAldoud1 year agoSuper User
Hi Anonymous
I'm happy to hear your issue was solved. Glad my solution helped as well.
Thanks for sharing your update.