Friday, March 23, 2012

Named calculation dataType

I have this expression in a named calculartion:

DATEDIFF("dd", [Date],[Maturity Date])/365

By default the datatype is INT? How can I have the result of the expression with decimal values? as 0,0974894 or 1,0008973 in spite of having 0 or 1.

Thanks!!

I have tried this, but doesnt work: :-(

CONVERT(NUMERIC(10,4),DATEDIFF("dd", [Date],[Maturity Date])/365)

CONVERT(DECIMAL(10,4),DATEDIFF("dd", [Date],[Maturity Date])/365)

|||

You need to convert the 365 as well.

Code Snippet

CONVERT(DECIMAL(10,4),DATEDIFF("dd", [Date],[Maturity Date])/ CONVERT(DECIMAL(10,4), 365))

No comments:

Post a Comment