Forum Discussion
lloydchughes
4 years agoNew Member
Create Task EndDate but exclude weekends
Hi, I'm trying to create an End Date for proejct task from StartDate + BuildTimeDays (Which is just a whole number) I want to exclude the weekends from the calculation and be able to display...
- 4 years ago
Hi,
If you do not have a calendar dim table, please check the below picture and the attached pbix file.
It is for creating a calculated column.
Enddate CC = VAR _mindate = MIN ( Data[StartDate] ) VAR _maxdate = DATE ( YEAR ( MAX ( Data[StartDate] ) ) + 1, 12, 31 ) VAR _calendartableexcludingsatsun = FILTER ( ADDCOLUMNS ( CALENDAR ( _mindate, _maxdate ), "@dayname", FORMAT ( [Date], "ddd" ) ), NOT ( [@dayname] IN { "Sat", "Sun" } ) ) VAR _count = ADDCOLUMNS ( _calendartableexcludingsatsun, "@count", COUNTROWS ( FILTER ( _calendartableexcludingsatsun, [Date] >= Data[StartDate] && [Date] <= EARLIER ( [Date] ) ) ) ) RETURN SUMMARIZE ( FILTER ( _count, [@count] = Data[BuildTimeDays] ), [Date] )
Jihwan_Kim
Super User
4 years agoHi,
If you do not have a calendar dim table, please check the below picture and the attached pbix file.
It is for creating a calculated column.
Enddate CC =
VAR _mindate =
MIN ( Data[StartDate] )
VAR _maxdate =
DATE ( YEAR ( MAX ( Data[StartDate] ) ) + 1, 12, 31 )
VAR _calendartableexcludingsatsun =
FILTER (
ADDCOLUMNS (
CALENDAR ( _mindate, _maxdate ),
"@dayname", FORMAT ( [Date], "ddd" )
),
NOT ( [@dayname] IN { "Sat", "Sun" } )
)
VAR _count =
ADDCOLUMNS (
_calendartableexcludingsatsun,
"@count",
COUNTROWS (
FILTER (
_calendartableexcludingsatsun,
[Date] >= Data[StartDate]
&& [Date] <= EARLIER ( [Date] )
)
)
)
RETURN
SUMMARIZE ( FILTER ( _count, [@count] = Data[BuildTimeDays] ), [Date] )