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
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Conditional Formatting (Solved)

Author  Topic 

jpverge
Starting Member

7 Posts

Posted - 2009-07-29 : 18:57:28
Hello,

I am using Report Builder 2.0 and am having trouble with some simple conditional formatting.

In the report designer I am trying to format the fill color based upon the value of the expression. I tried this:

=Iif(Me.Value < 0, "Red", "Black")

(Straight out of the help manual)

The value of that cell will range from 0% - 100%. I am using this expression to get that data:

=FormatPercent(sum(Fields!Yes_Count.Value)/sum(Fields!Yes_Count.Value+Fields!No_Count.Value),0)

The problem i'm having is when I change the parameters of the conditional formatting to any number besides zero, all I get is red text.

For example, if I use the expression:
=Iif(Me.Value < .001, "Red", "Black")

Even values that are 100% come out red.

Any suggestions?

yavvie
Starting Member

46 Posts

Posted - 2009-08-03 : 02:48:44
have you tried putting the whole calculation in the expression?

=Iif((sum(Fields!Yes_Count.Value)/sum(Fields!Yes_Count.Value+Fields!No_Count.Value)) < 0, "Red", "Black")

anyway check that the calculation gives correct results and that you reference the right values :)
Go to Top of Page

jpverge
Starting Member

7 Posts

Posted - 2009-08-06 : 14:35:42
quote:
Originally posted by yavvie

have you tried putting the whole calculation in the expression?

=Iif((sum(Fields!Yes_Count.Value)/sum(Fields!Yes_Count.Value+Fields!No_Count.Value)) < 0, "Red", "Black")

anyway check that the calculation gives correct results and that you reference the right values :)



I tried this and got the same result.

When I reference the value of something that is being formatted as a percent what's the right way to reference?

Example:

Value - Reference
100% - 1
50% - .50


Go to Top of Page

jpverge
Starting Member

7 Posts

Posted - 2009-08-06 : 14:42:59
Ahhh! That did it!

yavvie I used your forumula and added a decimal and that did the trick!

thanks!

JP
Go to Top of Page

jpverge
Starting Member

7 Posts

Posted - 2009-08-14 : 19:36:19
Just want to share the expression with the group:

=Iif((sum(Fields!Yes_Count.Value)/sum(Fields!Yes_Count.Value+Fields!No_Count.Value)) LIKE “NaN”, "LightGrey", Iif((sum(Fields!Yes_Count.Value)/sum(Fields!Yes_Count.Value+Fields!No_Count.Value)) >= .895, "LimeGreen", Iif((sum(Fields!Yes_Count.Value)/sum(Fields!Yes_Count.Value+Fields!No_Count.Value)) >= .795, "Khaki", "Tomato")))

I use this for the Fill property to shade certain values as follows:
100%-90% Green
89%-80% Yellow
79%-0% Red
Go to Top of Page

eric_lord
Starting Member

2 Posts

Posted - 2009-08-25 : 10:33:14
I still need to know why I can't get this to work using the "Me.Value" object.property. I have many cells containing diverse and complex formulas. I would like to perform the same operation on the background color for all of these cells. If the cell is negative set bgcolor to red. If the cell is positive set bgcolor to green.

If I take the approach above I would need to maintain these numerous complex formulas in two places. Considering the usability of the interface, I don't find this prospect very appealing.

Any Ideas why it doesn't seem that "Me.Value" can be used?
Go to Top of Page

eric_lord
Starting Member

2 Posts

Posted - 2009-08-25 : 10:41:41
Nevermind... I found the issue. If there are any "expressions" in the footer, it doesn't work. So, it's a bug. Remove expressions from any footer entities and enjoy.
Go to Top of Page
   

- Advertisement -