IIF Statement if dataset field value equals value of dataset field

Team:

Using this IIF statement:

=CountDistinct(IIF(Fields!Released_DT.Value = Fields!Date2.Value, Fields!Name.Value,

Nothing))

Released_DT = a date  - 09/03/2015 or 09/02/2015

Date2 = returns another date value in this case 09/03/2015

What I'm trying to do is: count distinct number of people (Fields!Name.Value) if the Relased_DT = Date2.

My IIF statement is returning a zero value.

Thanks,

jer

September 3rd, 2015 11:17am

Hi ,

Are the date format same in both the fields or of different types.Because that might be a reason why it will fail

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 12:57pm

Milan:

Using the following:

Released_DT = RelasedDT (smalldatetime, null) / covert(varchar, tblrelease.releaseddt, 101) as [Released DT]

Date2 = convert (varchar(8), {fn Now()}, 22) as [Date2]

Thanks,

jer

September 3rd, 2015 1:42pm

Team:

Got it to work with the following:

=

"Total Released for date  " & Fields!Date2.Value & ":  " & CountDistinct(IIF(Fields!Released_DT.Value = Today(), Fields!Name.Value, Nothing))

and

=

"Total Released for date    " & Fields!Date1.Value & ":  " & CountDistinct(IIF(Fields!Released_DT.Value = DateAdd("d",-1,Today()), Fields!Name.Value, Nothing))

Thanks

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 2:51pm

Hi jr7138,

Glad to hear that your issue had been solved by yourself. Thank you for your sharing which will help other forum members who have the similar issue.

Would you please mark the solution as an answer? So that we are able to close the thread.
 
If you have any question, please feel free to ask.

Best regards,
Qiuyun Yu

September 3rd, 2015 10:18pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics