Friday, February 28, 2014

Calculate Date of Birth in SSRS

You can utilize this code in an Expression to find the Date of Birth.
=IIF(IsNothing(Fields!dateofbirth.Value), "",
IIF( ((Month(Now) - Month(Fields!dateofbirth.Value)) < 0) 
OR ((Month(Now) - Month(Fields!dateofbirth.Value)) = 0 
AND (Day(Now) - Day(Fields!dateofbirth.Value)) < 0), 
(Year(Now) - Year(Fields!dateofbirth.Value)) - 1,
(Year(Now) - Year(Fields!dateofbirth.Value))
))

No comments: