How to calculate the date difference for each record, then average that?

99 Views Asked by At

I am totaling all open dates and all closed dates then taking the difference.

This is the expression I have that is not working for me. =Avg(DateDiff("d",Fields!Opened_Date.Value, Fields!Closed_Date.Value))

It just displays error on the report in the expression field.

I've attached an image of my dataset along with the form and highlighted part of where my expression needs to be.

I'm trying to average the days between open and close date fields but need to first calculate the difference between the two fields and then average. There are thousands of rows in this report, and I need it to function for my manufacturer team.

1

There are 1 best solutions below

0
TemiJ On

This might be because the data types of your date fields are not compatible with the DateDiff function. If the datatype is compatible then

Use this

=Avg(DateDiff("d", Fields!Opened_Date.Value, Fields!Closed_Date.Value, 
"YourDataSetName"))

This would calculate the average number of days between open and closed date for your data