Forum Discussion
_chris_
2 years agoHelper III
Little measure problem
Hi, I have a fact table with time bookings of employees and a date table which are related through the date field. I need two measures to figure out the number of occurences of weekend work a...
- Anonymous2 years ago
Hi _chris_ ,
Here are the steps you can follow:
1. Create measure.
WE<4 = var _sum= IF( MAX('Table'[Day of Week]) in {"Saturday","Sunday"}, SUMX( FILTER(ALL('Table'), 'Table'[Date]=MAX('Table'[Date])),[Hours]),BLANK()) return IF( _sum >=0 && _sum <=4&&_sum <>BLANK(),1,0)WE>4 = var _sum= IF( MAX('Table'[Day of Week]) in {"Saturday","Sunday"}, SUMX( FILTER(ALL('Table'), 'Table'[Date]=MAX('Table'[Date])),[Hours]),BLANK()) return IF( _sum >4&&_sum <>BLANK(),1,0)2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
2 years agoNot applicable
Hi _chris_ ,
Here are the steps you can follow:
1. Create measure.
WE<4 =
var _sum=
IF(
MAX('Table'[Day of Week]) in {"Saturday","Sunday"},
SUMX(
FILTER(ALL('Table'),
'Table'[Date]=MAX('Table'[Date])),[Hours]),BLANK())
return
IF(
_sum >=0 && _sum <=4&&_sum <>BLANK(),1,0)WE>4 =
var _sum=
IF(
MAX('Table'[Day of Week]) in {"Saturday","Sunday"},
SUMX(
FILTER(ALL('Table'),
'Table'[Date]=MAX('Table'[Date])),[Hours]),BLANK())
return
IF(
_sum >4&&_sum <>BLANK(),1,0)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
_chris_
2 years agoHelper III
Hi, thank you, this works perfectly!