Discussion

Ask a Question
Back to All

In a report How to calculate the number of days delayed

In a tabular report I want to have the number of days delayed at epic level based on the Planned End date and actual end date

How can i put this logic in the report?

  • If planned end date is already due and still the actual end date is blank then
    • the number of delay days = Now() - Planned end date
  • Also If planned end date is less than the Actual end date then
    • the number of delay days = Actual end date - Planned date

I have used the below mentioned code but it is wrongly calculating when planned end date = actual end date and also when planned end date is already due and still the actual end date is blank the number of days calculated is usually 1 day less

CASE
	WHEN
		[Planned End Date] < NOW()
	THEN
		DATEDIFF(
			[Planned End Date],
			NOW(),
			'day'
		)
	WHEN
		[Planned End Date] < [End Date]
	THEN
		DATEDIFF(
			[Planned End Date],
			[End Date],
			'day'
		)