Forum Discussion
Anonymous
6 years agoNot applicable
Calculate %Overtime worked with SLICER
Hello, I need to calculate %OT worked and have that number be dynamic (changing around slicer selection). I know I could use =SUM(SCHED_OT_HRS) + SUM( UNSCHED_OT_HRS) / SUM TOTAL HRS but this gi...
AllisonKennedy
Community Champion
6 years agoYou need to do that suggestion as a MEASURE, the X part in the AVERAGEX creates a virtual calculated column for you.
the NaN is because total hours is sometimes zero, so put that in a DIVIDE function:
MEASURE = AVERAGEX(WorkTable, DIVIDE(WorkTable[Sch_OT_HRS]+ WorkTable[UNSCHED_OT_HRS]) , WorkTable[TOTAL_HRS]),0))
Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos.
I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.
Anonymous
6 years agoNot applicable
What am I missing?
Measure 2 = AVERAGEX('Labor_Hours_Team_Summary_2020-0', DIVIDE('Labor_Hours_Team_Summary_2020-0'[SCHED_OT_HRS] + 'Labor_Hours_Team_Summary_2020-0'[UNSCHED_OT_HRS]) , 'Labor_Hours_Team_Summary_2020-0'[TOTAL_HRS]),0))
It seems to error toward the end.