Forum Discussion
Anonymous
5 years agoNot applicable
How to Use a variable as filter in caclulate
I am trying to sum all the employees that left between 30 to 365 days. how can I use the "flag" in the calculate formula? # Under 1 year = var workStartDate=MAX('Employee data for PBI'[Work ...
Tanushree_Kapse
Impactful Individual
5 years agoHi Anonymous ,
you can use this measure:
# Under 1 year =
var workStartDate=MAX('Employee data for PBI'[Work Start Date])
var workEndDate=MAX('Employee data for PBI'[Final Process Date])
var seniority= DATEDIFF(workStartDate, workEndDate, DAY)
var flag=IF(seniority>=30 && seniority<=365,1,0)
return CALCULATE(SUM('Employee data for PBI'[# Terminated]),seniority>=30 && seniority<=365)
- Anonymous5 years agoNot applicable
thanks Tanushree_Kapse but when I try what you suggest I'm getting the following error :
The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column.