Can I colour a column using Interactive Sorting? - reporting-services

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.

Related

In SSRS, how do I conditionally format the background color of the lines of a table AFTER the visibility expression has resolved?

My company has reporting standards that require the lines of a table to alternate in color for readability purposes. I know how to do that, however the latest report that I am working on has conditional visibility on each line.
What happens is that the alternating background color gets applied to the table before the visibility condition gets checked, leaving a the report with no pattern of background color to speak of.
I have searched for any kind of setting to change when certain property expressions get applied to a table. There doesn't seem to be one.
Any assistance would be greatly appreciated!
This article deals with the RowNumber function in SSRS. It contains an example of alternating row colors in the Tablix.
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/report-builder-functions-rownumber-function?view=sql-server-ver15
=IIF(RowNumber("GroupbyCategory") Mod 2, "White", "PaleGreen")
I found the solution here:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8365ca9b-7a50-4024-a706-4516ed12c038/how-to-maintain-alternating-row-background-colors-while-making-blank-rows-invisible?forum=sqlreportingservices
Instead of applying the formatting across all rows, I only apply it using the same visibility conditions that hides the rows in question. The example in the link uses blank rows where I will use some extra logic instead.

SSRS Change Row Color for First Row of Sorting

I have a table that is sorted by Main Tank and would like to make the first row of each sort (where the name of main tank switches to a new tank) to be grey. So if you have 10 rows with only 2 tanks you would have two lines of gray, the first for each new tank. I though I could possibly use RunningValue for this but haven't been able to get that to work. Any suggestions on a function or method I could use for this?
I think you can achieve that checking if the current value is equal to the previous, in that case you set the background-color the color you want.
I've used this table to test.
Select the row, in Background-color property use this expression:
=iif(
Fields!Tank.Value=previous(Fields!Tank.Value),
"Transparent",
"Red"
)
Replace "Red" for the color you want.
It will produce something like this:
Let me know if this helps.
Add a partitioned ROW_NUMBER() to the dataset and use it in the background color expression for the row to set the color to gray when the row number = 1.

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.

Access UI chart text legend sorted as number

I have searched for a solution but I can't find one suitable on this problem.
I have a chart in access where the Y-axis is text but starts with a number, so up along the y-axis i get this:
I know why, but I don't know how to fix it.
They all have an ID which is fine. I can chose to put the ID on the Y-axis, but then the kW range can't be visualized.
How is this changed?
Changing the text to number is not possible as it needs to be like "a-b kW".
Thanks in advance.
For those who might get this problem, I found out why.
When selecting the data, it chose to use the "Total" function, and "Avg" because that is what the values are. (The picture below says "Group By" but it was automaticly set to "Avg". I just forgot to change it when i snipped for stack.
That results in:
But if i remove the "Total" function i get this:
So, removing the "Total" function works here...
In your query, can you sort by ID, but not display it (e.g., in the query designer, sort 'descending/ascending' on the ID field, but clear the 'display' check box)?
As an aside, I've always had a tough time with Access charts... on my last project, the customer wanted a rather complex bar chart, and I ended-up drawing and resizing rectangle objects to get the look that the customer wanted.

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.