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
 Development Tools
 Reporting Services Development
 IIF statement to change color for negative numbers

Author  Topic 

huynhtl
Posting Yak Master

107 Posts

Posted - 2008-06-24 : 13:30:10
Hi,
Not sure what I did wrong to this code. What I would like this code to produce is, if any number is less than 0 (negative) than it should be red, if it's greater than 0, it should be black. Somehow it comes back red even though it's a positive number.


=iif(Fields!balance.Value < 0,"red","black")
1,106,666
472,169
-61,991
680,138
101,507
83,670
19,673
17,649
2,344,837

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-25 : 02:10:05
Just give this expression for color property of cell

IIF(Me.Value<0,"Red","Black")
Go to Top of Page

huynhtl
Posting Yak Master

107 Posts

Posted - 2008-06-27 : 17:40:20
I got it in the rows, now i'm having problem with it in the subtotal.
I have 4 columns and I would like the color to be change if negative, red, if positive,black in the subtotal.
I've tried =iif(sum(me.value) < 0,"red","black") and iif(sum(me1.value) <0,"red","black") and iif(sum(me2.value) <0,"red","black")
and iif(sum(me3.value) <0,"red","black").
This just give me an error.
Please HELP!!!!!!!!!!!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-28 : 03:15:32
quote:
Originally posted by huynhtl

I got it in the rows, now i'm having problem with it in the subtotal.
I have 4 columns and I would like the color to be change if negative, red, if positive,black in the subtotal.
I've tried =iif(sum(me.value) < 0,"red","black") and iif(sum(me1.value) <0,"red","black") and iif(sum(me2.value) <0,"red","black")
and iif(sum(me3.value) <0,"red","black").
This just give me an error.
Please HELP!!!!!!!!!!!!



no need of sum there just give Me.Value itself.
Go to Top of Page
   

- Advertisement -