Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

challenge for dax gurus

Hi Dax and math gurus.

 

 

Overtid 2 test =
var __dailyReduction = 0,5
var __dailyThreshold = 9,5
var __result2 =

SUMX(
UNION(
FILTER(
SUMMARIZE(
powtime;
powtime[date_start];
Kalender[Day of Week];
labour[labour_name];
"Value";
var __baseHours = [timer tot]
var __shouldApplyReduction = __baseHours > __dailyThreshold
var __reduction = __dailyReduction * __shouldApplyReduction
var __legalWorktimeReduction = 7,5
return
__baseHours - __reduction - __legalWorktimeReduction
);
[Value] >= 0 && Kalender[Day of Week] <> 6 && Kalender[Day of Week] <> 7
);
FILTER(
SUMMARIZE(
powtime;
powtime[date_start];
Kalender[Day of Week];
labour[labour_name];
"Value";
var __baseHours = [timer tot]
return
__baseHours
);
[Value] >= 0 && OR(Kalender[Day of Week] = 6; Kalender[Day of Week] = 7))
);
[Value]
)

return

__result2


....................................

Im in dire need to get this done but i cant figure out how to get the results i want as i am only starting to learn DAX.

the calculation cannot be altered too much either because i need the sum to be on the right side in the matrix as is.
 
All help is appreciated
I need __result2 to be; 
 
Up until 37,5 hours per week where work per 24 hours does not exceed 9 hours, overtime is everything above 9 hours.
 
And
 
Where hours exceed 37,5 hours per week up until 40 hours a week overtime is everything above 7,5 hours. 

this calculation does also need to include whatever is in the Dax from before. like everything worked Sunday is overtime and friday-saturday is above either 7,5 or 9 hours.