Forum Discussion
matus_jun
1 year agoFrequent Visitor
Count reset
Im sorry my english is not good what i want is count NewdayType if NewdayType is 1 continue counting if 0 set to 0 base on emp_id
- Anonymous1 year ago
Hi matus_jun ,
Based on the testing, try using the following DAX formula to create a new column.
CountByNewDayType = VAR CurrentEmployee = 'New day table'[employee_id] VAR CurrentIndex = 'New day table'[Index] VAR PreviousRows = FILTER( 'New day table', 'New day table'[employee_id] = CurrentEmployee && 'New day table'[Index] < CurrentIndex ) VAR PrevRowWithZero = MAXX( FILTER( PreviousRows, 'New day table'[NewDayType] = 0 ), 'New day table'[Index] ) RETURN IF( 'New day table'[NewDayType] = 0, 0, COUNTROWS( FILTER( PreviousRows, 'New day table'[Index] > PrevRowWithZero ) ) + 1 )Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
Hi matus_jun ,
Based on the testing, try using the following DAX formula to create a new column.
CountByNewDayType =
VAR CurrentEmployee = 'New day table'[employee_id]
VAR CurrentIndex = 'New day table'[Index]
VAR PreviousRows =
FILTER(
'New day table',
'New day table'[employee_id] = CurrentEmployee &&
'New day table'[Index] < CurrentIndex
)
VAR PrevRowWithZero =
MAXX(
FILTER(
PreviousRows,
'New day table'[NewDayType] = 0
),
'New day table'[Index]
)
RETURN
IF(
'New day table'[NewDayType] = 0,
0,
COUNTROWS(
FILTER(
PreviousRows,
'New day table'[Index] > PrevRowWithZero
)
) + 1
)
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
matus_jun
1 year agoFrequent Visitor
wow It work thank you alot