SSRS IIF Date evaluation
As I understand the requirement, you'll need to add another IIf() section which checks the difference in days between the two dates, then displays effectiveDate if the difference is < 30 days:
=IIf
(
Fields!Freeze.Value
, IIF
(
DateDiff(DateInterval.Day, Fields!effectiveDate.Value, Fields!FreezeDate.Value) < 30
, Fields!effectiveDate.Value
, Fields!FreezeDate.Value
)
, IIF
(
Month(Fields!effectivedate.Value) <> Month(Now())
, Format(Now(), “MM/dd/yyyy”)
, Fields!effectivedate.Value
)
)
Michigan Man
Updated on June 25, 2022Comments
-
Michigan Man almost 2 years
I have the following code
=IIf(Fields!Freeze.Value, Fields!effectivedate.Value, IIF(Month(Fields!effectivedate.Value) <> Month(Now()), Format(Now(), “MM/dd/yyyy”) , Fields!effectivedate.Value))
A. In the first IIF statement I check to see if the Fields!Freeze.Value is true, if its true then It displays Fields!effectivedate.Value (IIf(Fields!Freeze.Value, Fields!effectivedate.Value)
B. In the second IIF statemenet I check if the Fields!effectivedate.Value is the current month, If it is the current month then it displays Fields!effectivedate.Value, If it is not the current month then it displays the current date.
I would like assistance on the following.
In the first IIF statement ,>>>
IIf(Fields!Freeze.Value, Fields!effectivedate.Value,
I want to evaluate a new value Fields!FreezeDate.value- If the Fields!Freeze.Value = true then check to see if the Fields!effectivedate.Value is 30 days or more less than Fields!FreezeDate.value. A. If its 29 days or less than Fields!FreezeDate.value then display Fields!effectivedate.Value B. If its 30 days or more less than the Fields!FreezeDate.value then display the Fields!FreezeDate.value
Example 1
Fields!FreezeDate.value = '12/30/2012' Fields!effectivedate.Value = '11/15/2010' then Display the Fields!FreezeDate.value
Example 2
Fields!FreezeDate.value = '12/30/2012' Fields!effectivedate.Value = '12/15/2010' then Display the Fields!effectivedate.Value
How would I write this in SSRS code?
Please ask for further clarification if i have failed to explain something properly.