# How to calculate Remaining days in a Selected Sprint?

Any idea how to calculate remaining days in a sprint selected via filter.

Expecting something like this.

If [selectedSprint] is closed
then 0
If [selectedSprint] is Open/Active
then actual remaining working days --i.e. 9 on day 1 of sprint or 5 on end of week 1 considering 2 week sprint.
If [selectedSprint] is Future
then return 10 --total working days in the sprint

When writing a condition with more than two options, then you might want to use construct CASE WHEN THEN (https://docs.eazybi.com/eazybijira/analyze-and-visualize/calculated-measures-and-members/calculated-measures#Calculatedmeasures-Conditions).
The formula for calculated measure might look like this:

``````case when [Sprint].CurrentHierarchyMember.Level IS [Sprint].[Sprint] then
--calculation performed only at Sprint level
CASE WHEN --(1) closed sprint
[Sprint].CurrentMember.GetBoolean("Closed")
THEN 0
WHEN --active sprint
NOT [Sprint].CurrentMember.GetBoolean("Closed") AND
DateCompare([Sprint].CurrentMember.get('Start date'),Now() ) <= 0 AND
(IsEmpty([Sprint].CurrentMember.get('Complete date')) OR
DateCompare([Sprint].CurrentMember.get('Complete date'),Now() ) >= 0 )
THEN --(2) workdays till the planned end date
DateDiffWorkdays(
'today',
[Measures].[Sprint end date] )
WHEN --(3) future sprint
NOT [Sprint].CurrentMember.GetBoolean("Closed") AND
(IsEmpty([Sprint].CurrentMember.get('Start date')) OR
DateCompare([Sprint].CurrentMember.get('Start date'),Now() ) > 0 )
THEN 10
END
end
``````

Bets,
Zane / support@eazyBI.com