Last post Mar 04, 2013 12:22 AM by Abhi.ssrs
Member
64 Points
765 Posts
Mar 01, 2013 01:28 PM|nissan|LINK
How can I combine these two expressions?
=IIF((Fields!SampleType.Value = "Fruit" & Fields!Quantity.Value > 25), "Red", "Black") =IIF((Fields!SampleType.Value = "Bars" & Fields!Quantity.Value > 6), "Red", "Black")
All-Star
114593 Points
18503 Posts
MVP
Mar 01, 2013 01:32 PM|Rion Williams|LINK
You'll just need to wrap each of your conditions within a single set of parentheses and use the "Or" operator.
=IIF(((Fields!SampleType.Value = "Fruit" And Fields!Quantity.Value > 25) Or (Fields!SampleType.Value = "Bars" And Fields!Quantity.Value > 6)), "Red", "Black")
This will result in "Red" if either of your two sets of conditions are met, or "Black" if neither of them are.
Mar 01, 2013 02:19 PM|nissan|LINK
Nice.. Thank you..
220 Points
64 Posts
Mar 04, 2013 12:22 AM|Abhi.ssrs|LINK
Hi, Another way is to use switch...it has better readability.
=Switch( (Fields!SampleType.Value = "Fruit" & Fields!Quantity.Value >25),"Red", (Fields!SampleType.Value = "Bars" & Fields!Quantity.Value >6) , "Red" , 1=1, "Black")
The last one is equal to a default case.
Member
64 Points
765 Posts
Multiple Expressions in IIF
Mar 01, 2013 01:28 PM|nissan|LINK
How can I combine these two expressions?
=IIF((Fields!SampleType.Value = "Fruit" & Fields!Quantity.Value > 25), "Red", "Black")
=IIF((Fields!SampleType.Value = "Bars" & Fields!Quantity.Value > 6), "Red", "Black")
All-Star
114593 Points
18503 Posts
MVP
Re: Multiple Expressions in IIF
Mar 01, 2013 01:32 PM|Rion Williams|LINK
You'll just need to wrap each of your conditions within a single set of parentheses and use the "Or" operator.
This will result in "Red" if either of your two sets of conditions are met, or "Black" if neither of them are.
Member
64 Points
765 Posts
Re: Multiple Expressions in IIF
Mar 01, 2013 02:19 PM|nissan|LINK
Nice.. Thank you..
Member
220 Points
64 Posts
Re: Multiple Expressions in IIF
Mar 04, 2013 12:22 AM|Abhi.ssrs|LINK
Hi, Another way is to use switch...it has better readability.
=Switch( (Fields!SampleType.Value = "Fruit" & Fields!Quantity.Value >25),"Red", (Fields!SampleType.Value = "Bars" & Fields!Quantity.Value >6) , "Red" , 1=1, "Black")
The last one is equal to a default case.