SSRS - Expression to count the rows for currentdate match or (parameter selected date) with some equivalent other columns

335 views Asked by At

In SSRS Expression, how to count the numbers of rows that present in today or yesterday in dataset with other equivalent condition,

For example

=COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!Opendate.Value) = 
    DateDiff(DateInterval.Day,Cdate("01/01/1900"), Now()), Fields!Opendate.Value, Nothing)) 

Using this expression I can check get the total count for today, it's working.

I need to add to check today date with other condition like:

If (today date and Fields!reason.Value = "Other") 

It's not working when I add reason value to check :

=COUNT(IIF(
     DateDiff(DateInterval.Day, Cdate("01/01/1900"), Fields!Opendate.Value) = 
     DateDiff(DateInterval.Day, Cdate("01/01/1900"), Now()) -1, Fields!Opendate.Value, Nothing ) **And Fields!reason.Value = "Other"**)

Please guide me

1

There are 1 answers

0
Strawberryshrub On BEST ANSWER

Just add it in your IIF() statement:

=COUNT(IIF(
           DateDiff(DateInterval.Day, Cdate("01/01/1900"), Fields!Opendate.Value) = 
           DateDiff(DateInterval.Day, Cdate("01/01/1900") 
           And Fields!reason.Value = "Other",
           Now()) -1,
           Fields!Opendate.Value,
           Nothing 
           )
        )