Forum Discussion
joupuma
6 years agoNew Member
Count rows with filters from another table
Good Morning, I have a problem and I don't know how to solve it. I have 2 tables, the first with all the production data and the second with a single column where there are the days that are holida...
- 6 years agoDo you also have a DimDate table? You will need one for this problem, then you just need to relate the Holidays to the date table, and FILTER the DimDate for Working Days and do a COUNTROWS on that in combination with the DATEDIFF.
- Anonymous6 years ago
// T1 with prod data: OrderDate, DeliveryDate // T2 with hols and weekends: ExclusionDate [Num Of Working Days] = // calculated column in T1 var __startDate = T1[OrderDate] var __endDate = T1[DeliveryDate] var __holidayAndWeekendCount = COUNTROWS( FILTER( T2, T2[ExclusionDate] >= __startDate && T2[ExclusionDate] <= __endDate ) ) var __result = __endDate - __startDate + 1 - __holidayAndWeekendCount return __resultBest
D
Anonymous
6 years agoNot applicable
// T1 with prod data: OrderDate, DeliveryDate
// T2 with hols and weekends: ExclusionDate
[Num Of Working Days] = // calculated column in T1
var __startDate = T1[OrderDate]
var __endDate = T1[DeliveryDate]
var __holidayAndWeekendCount =
COUNTROWS(
FILTER(
T2,
T2[ExclusionDate] >= __startDate
&&
T2[ExclusionDate] <= __endDate
)
)
var __result =
__endDate - __startDate
+ 1 - __holidayAndWeekendCount
return
__result
Best
D