Report Builder Conditional formatting highlight wrong values - reporting-services

I have a bit of a conundrum
All I want to do is change the font color of a value in a matrix to red if the value is less that 0 and black otherwise
I use the following formula
=IIf(Fields!YTD.Value<0,"Red","Black")
Yet in my table the wrong values are turned red
Another example
=IIf(Fields!MTD_VtO.Value<0,"Red","Black")
results in
What am I missing here?!?!

Related

SSRS 2013 - Changing colour of cell dependent of outcome of expression within cell

I've asked a similar question recently (See below) however I'm now struggling with a similar scenario.
I have a cell with an expression which is a formula to calculate a % difference, and then depending on the value the percentage difference, I want the cell to change colour. if it's over 1% red, if it's under 1%, green.
The current expression which works to calculate the percentage is;
=(Sum(Fields!P1RateAmount.Value) - Sum(Fields!P1Amount.Value)) / (SUM(Fields!P1Amount.Value)) * 100
I'm presuming I need to wrap a IIF around it, but when I have tried it hasn't worked
If anyone could help me with this I'd be very grateful
Also for context, the formula can't be done in SQL to get a number as I'm using collapsing columns and the percentage formula I'm using in SQL brings back the first row when used within SSRS, and doesn't take into account the full sum
Previous Question asked as referred to above
The expression for the BackgroundColor property of your text box would be:
=IIF( (Sum(Fields!P1RateAmount.Value) - Sum(Fields!P1Amount.Value)) / SUM(Fields!P1Amount.Value) * 100 > 1, "#fff5fa", "MintCream")
I prefer a light shade of green or red but you can substitute the colors with Red and Green if you want to hit them over the head with it.
Just for anyone who may be looking at something similar, the following worked for me
=Switch(
me.value <=-1 OR me.value >=1, "Red"
,me.value >-1 OR me.value <1, "Green"
)
I think this is because the cell already had an expression of
=(Sum(Fields!P1RateAmount.Value) - Sum(Fields!P1Amount.Value)) / (SUM(Fields!P1Amount.Value)) * 100
to get number, the 'IIF' and then referencing the cells wouldn't work. However me.value would look at the value of the cell rather than working the formula, thus bringing back the desired colour

Alternate Row Colour SSRS not working

i currently have the row background colour set with expression that is;
=IIF(ROWNUMBER(NOTHING) MOD 2,"White","Silver")
However on some rows it seems that colour is not alternating and staying the same like the image below. Does any one know why this may be happening
The expression itself is fine, it's the scope that's the problem. The ROWNUMBER function gives different results based on which groups it's in within your matrix. You are currently using Nothing as the argument which tells it to use the default scope. You will need to look into overriding that with the correct group name so that the row numbers are calculated relative to the scope you actually want.

Can I colour a column using Interactive Sorting?

I'm using interactive sorting on multiple columns and would like to change the background colour based on the column being sorted rather than just the little arrow indicator. Does anyone have any ideas?
Thanks
There is no way you can change colors while you do interactive sorting. Instead you can try the conditional formatting in SSRS.
It's possible to use the Previous function in a cell's BackgroundColor, but it's not a perfect solution. The following will shade most of a column pink if ascending and green if descending - however the first data row can't be controlled this way (since there's no Next function), and the column will have varying colours if it's sorted by a separate field.
=IIF(IsNothing(Previous(Fields!NUM.Value)), "White",
IIF(Previous(Fields!NUM.Value) > Fields!NUM.Value, "LightGreen",
IIF(Previous(Fields!NUM.Value) < Fields!NUM.Value, "Pink",
"White")))
This is as close as I've managed, so I suspect Ajith is correct.

How to give Custom color to the value

I have many tablix in report, User need all negative values in red color,
i tried with iif condition at the color option, but it going to consume lot of time since i need to modify each and every cell
Can any body suggest me is there any way to give color to cell without going to the color option
Thanks
it will be a great help to me
To make copying the formula easier, use the built-in Me reference, which accesses the current object (being the cell):
=IIF(Me.Value < 0, "Red", "Black")
Now you can just copy and paste that into the Font.Color property without having to edit the expression for the field value.

In SSRS how to conditionally change the colour of a datalabel font on a chart when it appears on the bar

I have created a bar chart that shows values on data labels.
The Data label is placed outside the bar
But in some cases the label appears on the bar where the bar is too long.
In this scenario I would like to conditionally change the font/colour of the data label so that it's more visible.
However I can't see a way to dynamically determine where the label has been placed.
What I can think of is this. You can change the background/font color of all those series labels who's value lies in the range of 95%-100% of the maximum "Value". To be exactly precise as to what should be the threshold to change the bg/font color seems a daunting task, but you could play around with test data.
For writing the expression to change the font color,I would first change the dataset and add a column on the lines of PercOfMax. This column can be calculated easily in the dataset by using basic aggregate functions.
Then you need to go to the Chart Series Label properties-->Color and write the expression on the lines of -
=IIF(Fields!PercOfMax.Value>=95, "YELLOW", "BLACK")
As I said, you might need to do some more research to finalize the value of this threshold(which I am assuming to be 95).
Another solution to this problem is to use fill colour of the label and set its background to a bright colour (e.g. colour), and leave the font colour of the label black. Thus you can always see the label, and there is no difference when it's outside of the bar.