Click here to Skip to main content
15,886,810 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
in need of some help calculating dates in ssrs.

I have two columns with two separate dates. one is application date and the other decision date. I'm pulling data for the prior month. I need to be able to get the average time between application date and decision date.

This is what I have to get the initial difference between the two dates:
=Datediff("d",fields!app_date.value,fields!decision_date.value) & "days" & datediff("h",Fields!app_date.value,Fields!decision_date.value)mod 24 & ":" & Datediff("n",Fields!app_date.value,Fields!decision_date.value)mod 60

I tried this to get the average:

=avg(Datediff("d",fields!app_date.value,fields!decision_date.value)) & "days" & avg(datediff("h",Fields!app_date.value,Fields!decision_date.value))mod 24 & ":" & avg(Datediff("n",Fields!app_date.value,Fields!decision_date.value)mod 60

Not working though :( Any help would be appreciated!
Posted
Comments
dan!sh 24-Jan-16 22:57pm    
You need to make use of row groups and datediff together to get the average. It will be really tough to help without knowing what "not working" means in this question.

1 solution

hello,

There is something wrong in logic.

Logic should be as below.. prepare formula accordingly.
VAR AverageDiffInMinute = Datediff(Hours, AppDate, DecisionDate) / 2

( AverageDiffInMinute % 60 ) % 24 = AverageDAYS
AverageDiffInMinute - (AverageDAYS * 24 * 60) = AverageHOURS
AverageDiffInMinute - (AverageHOURS * 60) = AverageMINUTES

Now display
"Avarage is... " + AverageDAYS + " days " + AverageHOURS + " hours" + AverageMINUTES + " Minutes"

Enjoy Coding!
:)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900