Forum Discussion
Joshua_
4 years agoHelper II
Get days worked between two dates
Hi Guys,
I need to add a column that shows me the working day of the month, but starting and ending on a specific date,
for example started Jan 10 and ending Jan 25
I tried to create a column but the result was the total of the days.
NEW COLUMN =
var ini = MIN(CAMPANA[FEC_INICIO])
Var fin = MAX(CAMPANA[FEC_FIN])
return
SUMX(
FILTER(
CALENDARIO,
CALENDARIO[Date]>= ini && CALENDARIO[Date]<= fin
),
CALENDARIO[DIAS_HABILES]
)
I think the DATESMTD function is an option but I can't change the first day of the month.
thank a lot!
HI parry2k ,
I created a second table containing the dates of the new table and connected it with my calendar table, then I got the business days (related function) and with the following formula I can do it.CALCULATE(SUM(CALENDARIO_CAMPANA[DIAS_HABILES]),FILTER(CALENDARIO_CAMPANA,CALENDARIO_CAMPANA[Date]<=EARLIER(CALENDARIO_CAMPANA[Date]) && CALENDARIO_CAMPANA[CAMPANA] = EARLIER(CALENDARIO_CAMPANA[CAMPANA])))
3 Replies
- parry2kSuper User
- Joshua_Helper II
HI parry2k ,
I created a second table containing the dates of the new table and connected it with my calendar table, then I got the business days (related function) and with the following formula I can do it.CALCULATE(SUM(CALENDARIO_CAMPANA[DIAS_HABILES]),FILTER(CALENDARIO_CAMPANA,CALENDARIO_CAMPANA[Date]<=EARLIER(CALENDARIO_CAMPANA[Date]) && CALENDARIO_CAMPANA[CAMPANA] = EARLIER(CALENDARIO_CAMPANA[CAMPANA])))