Search code examples
ssrs-2008

SSRS IIF expression with multiple criteria


I am trying to default this fields date value based on multiple criteria.

I have a field for 'Program_Status' which can either be 'active' or 'inactive' or 'complete' I have a field for 'Program_Ended_On' which is my field I am trying to populate.

Criteria: If field 'Program_Status' is <>'Active' and the field 'Program_Ended_On' is within 30 days past up till today, then I want to display the 'End Date'.

I have tried several ways with errors. =IIF( Fields!Program_Status.Value <>"Active", Dateadd("m",-1,today()),Fields!Program_Ended_On.Value)

Any thoughts? Thank you


Solution

  • You can try the below code. If Program_status is not equal to Active and if Program_Ended_On is within 1 month of today then the expression will give Program_Ended_On value else it will give 0 as output. You can modify this expression as per your requirement

    =IIF(Fields!Program_Status.Value<>"Active" AND Fields!Program_Ended_On.Value  >= DATEADD("m",-1,Today()),Fields!Program_Ended_On.Value,0)