Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 holidays and weekends. The days that are working days do not appear in that second table.
In the first table I have 2 fields that are dated, the first the Date when the order was placed, and the other when the product must be delivered to the customer.
The goal of everything, is that I have to get to know the number of working days between the 2 dates.
I already have the part of the difference between the dates, but I don't know how to subtract the number of Holidays that come from the other Table.
I have tried it with the COUNTROWS and FILTER functions, but I cannot solve it ...
Could you help me?
Thanks and greetings,
Solved! Go to Solution.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
// 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
// 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
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 9 | |
| 5 | |
| 5 |