2 Replies Latest reply on Sep 5, 2018 12:53 PM by Chris Helmey

# Difference between 2 dates within a subset

Here is the problem I am running into.....I need to show the difference between the dates that fall within the same program. So in the below screenshot I need to show the difference between the dates for CND SADR (12/14/2015) and CND ACAS (3/1/2016) in days because they are both in Program 1. I assume this needs to be done by a table calculation but I am really having a hard time getting it to work,

The result I am looking for is CND SADR would show 0 or blank and the CND ACAS would show 78 (3/1/2016 - 12/14/2015). The rest would be 0 because they only have one date per program.

I attached the workbook and the calculation I was working on was called Refresh Rate (to see my calc)

Can someone help me out...I am stuck?

Thanks,

• ###### 1. Re: Difference between 2 dates within a subset

What I did was create a calculated field for "Min Date" and for "Max Date" by Program.  I then created an LOD expression to calculate the number of days between the two fields if the Acronym Min date is >= Max date for the program. See below for the four calculations I created:

Min Date:

{ FIXED [Program]:MIN([Avail Start])}

Max Date:

{ FIXED [Program]:MAX([Avail Start])}

Acronym Min Date

{ FIXED [Deliverable Acronym]:MIN([Avail Start])}

Refresh Rate

IF [Acronym Min Date] >= [Max Date]

THEN DATEDIFF('day',[Min Date],[Max Date],'sunday')

ELSE 0

END

Hope this helps and if you have questions let me know.

• ###### 2. Re: Difference between 2 dates within a subset

Made changes to original comment, now should work properly