Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 ssrs expression

Author  Topic 

Anand.A
Posting Yak Master

109 Posts

Posted - 2012-03-09 : 07:41:49
hi

i create report in ssrsin that report i want to write expression

like

Month_number is in (2,4)

and

Customer_id in( 23,56,89)

how to write iif expression for this so my expression statisfy this 2 condition


ex:

i wrote a expression like this

This Correct :

=iif(DateDiff("M",Fields!TIME_DATE.Value,Now())=6

and DateDiff("M",Fields!TIME_DATE.Value,Now())=12
and Fields!Customer_id .Value=2
and Fields!Customer_id .Value=3
and Fields!Customer_id .Value=6
and Fields!Customer_id .Value=7,Fields!TRANSACTION_AMOUNT.Value,NOTHING)

anand

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-03-09 : 08:11:44
You have to use a combination of And and Or keywords as appropriate, keeping in mind to use brackets as appropriate. In your example, this may be what you need:
=iif((DateDiff("M",Fields!TIME_DATE.Value,Now())=6

or DateDiff("M",Fields!TIME_DATE.Value,Now())=12)
and (Fields!Customer_id .Value=2
or Fields!Customer_id .Value=3
or Fields!Customer_id .Value=6
or Fields!Customer_id .Value=7),Fields!TRANSACTION_AMOUNT.Value,NOTHING)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-09 : 11:08:03
quote:
Originally posted by Anand.A

hi

i create report in ssrsin that report i want to write expression

like

Month_number is in (2,4)

and

Customer_id in( 23,56,89)

how to write iif expression for this so my expression statisfy this 2 condition


ex:

i wrote a expression like this

This Correct :

=iif(DateDiff("M",Fields!TIME_DATE.Value,Now())=6

and DateDiff("M",Fields!TIME_DATE.Value,Now())=12
and Fields!Customer_id .Value=2
and Fields!Customer_id .Value=3
and Fields!Customer_id .Value=6
and Fields!Customer_id .Value=7,Fields!TRANSACTION_AMOUNT.Value,NOTHING)

anand


the above expression and your explanation are not the same
But you should be able to use expression in simlar lines

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -