cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Report SUM Case when

former_member264311
Participant
0 Kudos

Good Day Expert,

How can I apply this code in Crystal report? Bec im always got an error "DateDiff is out of range"

ISNULL(SUM(CASE when (DATEDIFF(dd,JDT1.RefDate,@Date) <=0)
then
case when syscred <> 0 then syscred * - 1
else sysdeb
end
end),0.00)

or

SELECT datediff("dd",{JDT1.RefDate},{?FromDate})
Case is >0: Sum({JDT1.BalDueDeb})-sum({JDT1.BalDueCred})
Default: 0

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Romel,

"dd" is not a valid interval type; it is "d".

If datediff("d",{JDT1.RefDate},{?FromDate}) > 0 then

Sum({JDT1.BalDueDeb})-sum({JDT1.BalDueCred})

else 0

-Abhilash

former_member264311
Participant
0 Kudos

Thank you so much sir.

Can you help me to my report. I want to display sum of previous balance when my parameter is JDT1RefDate>=FromDate and JDT1.RefDate<=ToDate. I want to display the Sum(BalDuedeb-BaldueCred) when JDT1.RefDate<FromDate

Thanks