Forum Discussion
LeonardCs
1 year agoHelper I
HELP WITH DAX - DATE CALCULATION CONDITION
I have a calendar table and a table with all the employees of the company. In this employees table, there are details like employee ID, admission date, and dismissal date for those who have already b...
- 1 year ago
Your formulas can be simplified
A_admissoes = COUNTROWS(TURNOVER) B_demissoes = CALCULATE(COUNTROWS(TURNOVER), USERELATIONSHIP(CALENDARIO[Date], TURNOVER[DATA_DEMISSÃO]))For the C measure you want to be very specific with your requirement. "Total active employees during the period " is too fluffy. Better would be to say "Total number of employees who were active on at least one day of the period.
C_ativosNoPeríodo = var d = values(CALENDARIO[Date]) var a = ADDCOLUMNS(all(TURNOVER),"Dem",COALESCE([DATA_DEMISSÃO],TODAY())) var b = ADDCOLUMNS(a,"i",COUNTROWS(INTERSECT(d,CALENDAR([DATA_ADMISSÃO],[Dem])))) return countrows(filter(b,[i]>0))
lbendlin
1 year agoSuper User
Your formulas can be simplified
A_admissoes = COUNTROWS(TURNOVER)
B_demissoes = CALCULATE(COUNTROWS(TURNOVER), USERELATIONSHIP(CALENDARIO[Date], TURNOVER[DATA_DEMISSÃO]))
For the C measure you want to be very specific with your requirement. "Total active employees during the period " is too fluffy. Better would be to say "Total number of employees who were active on at least one day of the period.
C_ativosNoPeríodo =
var d = values(CALENDARIO[Date])
var a = ADDCOLUMNS(all(TURNOVER),"Dem",COALESCE([DATA_DEMISSÃO],TODAY()))
var b = ADDCOLUMNS(a,"i",COUNTROWS(INTERSECT(d,CALENDAR([DATA_ADMISSÃO],[Dem]))))
return countrows(filter(b,[i]>0))
- LeonardCs1 year agoHelper I
You understood perfectly. I conducted some tests, and it worked very well. Thank you so much for your help once again 🙌🙌