I have a calendar table with a column WorkingDay that has a 1 for working days and 0 for weekends and holidays. A typical helper column to get business days would be:
And I can then take the AVERAGE( Orders[Business Days from Approval to Dispatch]) of that column in a measure.
I have a *lot* of dates where I'd like to get the number of business days between events in different tables. Instead of having a helper column and a measure for each duration I'd like to just have a single measure for each duration, but I'm tying myself in knots trying to figure out how to correctly relate the dates in the tables without the helper column.
In this example Requisitions is 1:many on Orders related by fields PrimaryKey and ForeignKey respectively. The Calendar table is also 1:many on the Order table.
Code:
Business Days from Approval to Dispatch=
CALCULATE (
SUMX (
Calendar,
Calendar[WorkingDay]
),
ALL ( Calendar ),
DATESBETWEEN (
Calendar[Date],
RELATED (Requisitions[Approval Date]),
Orders[Dispatch Date]
)
) - 1
I have a *lot* of dates where I'd like to get the number of business days between events in different tables. Instead of having a helper column and a measure for each duration I'd like to just have a single measure for each duration, but I'm tying myself in knots trying to figure out how to correctly relate the dates in the tables without the helper column.
In this example Requisitions is 1:many on Orders related by fields PrimaryKey and ForeignKey respectively. The Calendar table is also 1:many on the Order table.