Reputation: 420
How to write multiple if statement in SSRS. I have written like this.
=IIf(Parameters!MyDuration.Value="ThisMonth" & Parameters!Transactions.Value="Sale", Sum(Fields!ThisMonthSal), True,False)
this is throwing an exception that multiple parameter used. Please guide me how to write this multiple if statement.
Upvotes: 0
Views: 19207
Reputation: 63830
The &
operator concatenates two strings. You're looking for the And
operator. Refer to this msdn article.
In addition, note that IIF has three parts (see decision functions here), and works like this:
=Iif(test, truepart, falsepart)
I'm not sure what you're trying to do with the "SUM" bit (or what you're trying to achieve at all, the question's not clear on that), but something like this would work:
=IIf(Parameters!MyDuration.Value="ThisMonth" And Parameters!Transactions.Value="Sale",
Iif(Sum(Fields!ThisMonthSal.Value) = 0, "Zero sum", "Non-zero sum"),
"Not thismonth or sale")
Finally, you're not entirely clear about the error you're getting. If you're also having a problem with accessing the parameter you may have to investigate that seperately. In any case, the above should explain the Iif
bit.
Upvotes: 5