Forum Discussion
Active and resigned employee count between a date range
- 5 years ago
Hi primolee,
Try the following formula to create measures:
Left = var _First = MIN('Table'[Date]) var _Last = MAX('Table'[Date]) var Table1 = SELECTCOLUMNS( FILTER( 'Table', 'Table'[Date].[MonthNo] = MONTH(_First) &&'Table'[Date].[Year] = YEAR(_First) ), "Employee", 'Table'[Employee] ) var Table2 = SELECTCOLUMNS( FILTER( 'Table', 'Table'[Date].[MonthNo] = MONTH(_Last) &&'Table'[Date].[Year] = YEAR(_Last) ), "Employee", 'Table'[Employee] ) return COUNTAX( EXCEPT(Table1,Table2), [Employee] )Joined = var _First = MIN('Table'[Date]) var _Last = MAX('Table'[Date]) var Table1 = SELECTCOLUMNS( FILTER( 'Table', 'Table'[Date].[MonthNo] = MONTH(_First) &&'Table'[Date].[Year] = YEAR(_First) ), "Employee", 'Table'[Employee] ) var Table2 = SELECTCOLUMNS( FILTER( 'Table', 'Table'[Date].[MonthNo] = MONTH(_Last) &&'Table'[Date].[Year] = YEAR(_Last) ), "Employee", 'Table'[Employee] ) return COUNTAX( EXCEPT(Table2,Table1), [Employee] )This is my PBIX file.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi primolee,
Try the following formula to create measures:
Left =
var _First = MIN('Table'[Date])
var _Last = MAX('Table'[Date])
var Table1 =
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Date].[MonthNo] = MONTH(_First)
&&'Table'[Date].[Year] = YEAR(_First)
),
"Employee",
'Table'[Employee]
)
var Table2 =
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Date].[MonthNo] = MONTH(_Last)
&&'Table'[Date].[Year] = YEAR(_Last)
),
"Employee",
'Table'[Employee]
)
return
COUNTAX(
EXCEPT(Table1,Table2),
[Employee]
)Joined =
var _First = MIN('Table'[Date])
var _Last = MAX('Table'[Date])
var Table1 =
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Date].[MonthNo] = MONTH(_First)
&&'Table'[Date].[Year] = YEAR(_First)
),
"Employee",
'Table'[Employee]
)
var Table2 =
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Date].[MonthNo] = MONTH(_Last)
&&'Table'[Date].[Year] = YEAR(_Last)
),
"Employee",
'Table'[Employee]
)
return
COUNTAX(
EXCEPT(Table2,Table1),
[Employee]
)
This is my PBIX file.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.