I have a chart which measures volume (y-axis) against date (x-axis). I have an Event table, which stores meaningful events, which I'd like to display as a vertical stripline on the chart. When there's data there, the field E_Text will be populated.
I've tried various methods, and am currently trying to only display using a change to the background colour, as such ("#00ffffff" is no colour):
=iif(Fields!E_Text.Value="","#00ffffff","Orange")
However, this statement always returns true, despite the data always being there. Has anyone managed to get data-driven striplines working?
Are you certain you are capturing nulls? A blank is something. NULL and (blank) are two different things. In SSRS Null is captured with Isnothing(), putting a value inside the parentheses. I have never had tried data driven strip lines with this method but this in the past has been an issue. Also can you test your function with an easier test first? EG: Set a simple dataset up and set the background color up with a dataset we know to have a null and a positive value:
Create test dataset
declare #Person Table ( person varchar(8), orders int);
insert into #Person values ('Brett', 10),('Sean', null)
select * from #Person
Put a table from the toolbox in and populate it with the two columns.
Set the background property of the [orders] column cell to
=iif( isnothing(Fields!orders.value), "White", "Red")
I now see a white and a red, HOWEVER if I do this:
=iif( Fields!orders.value = "", "White", "Red")
I get always white.
Related
I am trying to add a fill color to a table that I created in SSRS. The data looks like the table as follows:
The task is whenever the value is over 7, then color the cell green, when the value is less than 7 then orange and if the value is below zero then the due time changes to a sentence as shown with ID 2 and is to be colored red.
I have achieved coloring the cells when greater than or less than 7 using the if statement on the Due(Mins) field value however, it fails to color the cell red when less than 0. I have used switch, instr functions, but haven't had any luck.
Can emphasize more. Appreciate the help.
Cheers,
Sid
=SWITCH(
Fields!Due.Value.ToString.Contains("OverDue"), "Red",
VAL(Fields!Due.Value) > 7, "Green",
True, "Orange"
)
Switch will stop when it hits the first expression that evaluates to True
So...
First we test if the value contains overdue and set red
Then we test if the value is greater than 7 and set the result to Green
The True at the end acts like an else
I have an SSRS Line chart which plots supply points with square feet on the X axis and Price on the Y axis. Right now I don't really care about making it pretty just getting the lines to show up correctly. I am plotting the points and grouping by Subdivision/Builder.
So for example Subdivision A has builders Y and Z. I want to show different colors and lines for Subdivision A builder Y verses Subdivision A Builder Z.
The problem is that the lines are not connecting when a point for another subdivision builder combination breaks up that line.
The grey line and points below are not all connected as the yellow point is between the grey points so the grey line is not connected to all grey points.
How can I make the points of the same color (same Subdivision/Builder) connected via a line?
As I found out the hard way recently, this problem is often caused by null values in the data not being properly handled by SSRS. Without seeing your data, I can't be certain that's the cause, but nulls were the culprit I encountered the same behavior.
The solutions usually involve assigning values to the color of the EmptyPoint property on the Series, sometimes in conjunction with setting the EmptyPointValue to specify null handling. I've found many references to this problem on the web, but I'll only post links to the best two, both of which are on StackExchange:
The thread SSRS Line Chart NULL VALUE - Horizontal Line contains a thorough discussion of this issue. The usual workaround given is to hard-code a color expression for each line using an IIf, but sometimes this isn't an option, especially if the field you're grouping on has dynamic, unpredictable values, as my dataset did.
The picture posted there depicts clear examples of the same type of line breaks. The user named trubs posted a code sample which illustrates how to set the EmptyPoint, in case where an Iif will work:
=iif(isNothing(Fields!SelectedValue.Value),'No Color',"LightBlue")
The first reply in SSRS Line Chart Not Connecting Data Points details a workaround for cases when the EmptyPoint value & nulls are the root cause and simple hard-coded IIfs won't do the trick. Although I have yet to get my line colors to match the point markers the way I'd like, I can verify that this solution at least gives you your lines back and allows you to assign a variety of colors to them. It's fairly simple and involves merely pasting in some VB code for a couple color properties.
I was asked in the comments section to provide the details of the solutions, but don't want to plagiarize, so I'll simply do a long direct quote of JohnBob's answer:
Firstly, in order to get the lines to join up, you need to set the
EmptyPoint colour for the series.
Select your series in your chart In the properties tab (not the
dialog) drill down into the EmptyPoint property and set the colour to
be Black
This will get them joining up - yay! But part of the line is colour
and the other part is black, right? That's a bit silly, especially
considering if you leave the colour to Automatic on the EmptyPoint
that it will be transparent.
So, then we need to get the series and the EmptyPoint's colours in
sync. Using code from here. I added some code to the code of the
report.
1). Right click on an empty space on the report and select "Report
Properties" 2). In the code tab, paste the following:
Private colorPalette As String() = {"#418CF0", "#FCB441", "#E0400A", "#05642E", "#1A3B69", "#BFBFBF", "#E0400A", "#FCB441", "DarkBlue", "Tomato", "Orange", "CornflowerBlue", "Gold", "Red", "Green", "LightBlue", "Lime", "Maroon", "LightSteelBlue", "Tan", "Silver"}
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
Then we need to call this code when setting the colour of the series
and of the EmptyPoint.
Select your series
In the properties tab paste something the following (replace WhateverTheGroupIsForYourSeries with your series group name):
=Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)
Drill down to the color element of the EmptyPoint Series property
Paste the same text as from point two [e.g. =Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)]
And voila! You're done! I can't believe how unnecessarily difficult
this is :D
I hope this helps.
Just put your Fields!(YourSeriesGroup).Value in Series Groups to above of
Fields!(YourCategoryGroup).Value in Category Groups, your series group should be in both Series Groups and Category Groups (should be above of your initial category group).
And after that right click horizontal axis and select Horizontal Axis Properties. Set Axis Type to Scalar and click OK.
I have a question, want some assistance.
Q) My question is that i have a chart in which analyst assigned for many incidents and some analyst have 1 or two incident assigned. just because of this the bar chart looks ugly some time. So thats why i used a new chart to represent Min incident count. But i want there some creativeness, for which i want there a radio button or OnClick event ( I do not know how to use both these. When report runs by default it`ll show Max incidents count chart and when we used radio button it will show Min incidents count chart, on the same chart area no need of new area or on new page.
Kindly help me or refer me some links and with ideas. As i have searched many blogs but i didn`t get any big achievement.
Below is my Simplified query;
SELECT
Count(IncidentDimvw.Id)
,UserDimvw.FirstName AS Analyst
FROM
IncidentDimvw
FULL JOIN WorkItemDimvw
ON IncidentDimvw.EntityDimKey = WorkItemDimvw.EntityDimKey
JOIN WorkItemAssignedToUserFactvw
ON WorkItemDimvw.WorkItemDimKey = WorkItemAssignedToUserFactvw.WorkItemDimKey
JOIN UserDimvw
ON WorkItemAssignedToUserFactvw.WorkItemAssignedToUser_UserDimKey = UserDimvw.UserDimKey
WHERE
WorkItemAssignedToUserFactvw.DeletedDate IS NULL
GROUP BY
UserDimvw.FirstName
Having (Count(IncidentDimvw.Id) = (#Count))
Having Clause is right or wrong, i donot know.
I used the following expresion in series as you suggested.
=iif(Parameters!Count.Value, Max(Sum(Fields!ID.Value)), Min(Sum(Fields!ID.Value)))
Sample data is as folows;
Regards
Muhammad Ahsan
I can think of a couple of ways to approach this:
Dynamic expressions based on parameter
Say you have a simple DataSet like:
And also a boolean parameter called showMax.
We can create a simple bar graph based on this:
The most important thing to note is that Series value is expression-based:
In the above example the expression is:
=IIf(Parameters!showMax.Value
, Max(Fields!value.Value)
, Min(Fields!value.Value))
i.e. when showMax is true, report the Max values, otherwise report the min values.
In this case I've also updated the Axis title, Chart title, and Custom legend text to be expression-based:
Axis Title: =IIf(Parameters!showMax.Value, "Max", "Min")
Chart Title: =IIf(Parameters!showMax.Value, "Max per group", "Min per group")
Custom legend text: =IIf(Parameters!showMax.Value, "Max value", "Min value")
The chart behaviour changes based on what parameter is selected as required:
Set Visibility based on parameter
Another option is simply to have to charts and hide one depending on parameter selection.
For example, for the Max chart the Hidden property can be set to:
=Not(Parameters!showMax.Value)
Setting this property correctly for each report will mean only one is ever displayed to the user, i.e. it will look dynamic.
Either of these options should work; the first keeps the layout simple in the designer makes the chart more complex, the second makes the layout more complex but keeps the charts simple.
Hopefully one option will work for you.
I have a report that has 3 parameters: RaceDate, RaceCourse, SilksColours. The SilksColours parameter is optional.
If the SilksColours parameter is selected I want to highlight the row in my report with the colour yellow, while all the other rows stay white.
Is this possible?
For each TextBox in the row you want to highlight, you need need to set the Background Color property to be expression-based and compare the parameter value to value in the row, something like:
=IIf(Fields!Colour.Value = Parameters!SilksColours.Value, "Yellow", "White")
Edit after comments:
OK, as you've noted there are two questions here.
Parameter with default
You have a requirement to have a multi-value parameter with the ability to specify no value in particular. You can't set up a multi-value to accept NULL values, so you need to add a catch all value to the DataSet. So base the parameter on values similar to the following:
Set a parameter up to use this DataSet and set the Default Value to None:
Now we have a parameter with a default, which will not highlight any rows, so users can just ignore if they want or choose values as required.
There is one minor annoyance here - the user can select None and other values as well, they aren't mutually exclusive, but it should be good enough.
Highlighting rows
Next step is to set the Background Color values for all required TextBoxes. Since multiple colours can be selected, we need to treat multi-value parameters differently from single ones, something like:
=IIf(InStr(Join(Parameters!Colour.Value, ","), Fields!Colour.Value) > 0
, "Yellow"
, "White")
So what we need to do is use the JOIN function to create a string list of selected values, then check if the row value is anywhere in that list. Put it all together to get the following:
The report will load straight away as the parameter has a default value, with no rows highlighted:
Choose one colour and the row is highlighted:
Choose multiple colours to highlight multiple rows:
Hopefully all this is what you're after!
I have a chart on which I'm using two colours for one series: red for values below a certain value and green for above.
Is there a way I could display two items in the legend for this series? So far I've tried using Iif in the legend's expression, but it returns only one value.
I suggest you add 2 calculated fields in your dataset one for below and one above. Here you can use 2 IIfstatements to separate the values in your chart.
Alternatively you should be able to add the field in question to the chart twice and add an expression as above to each one for above and below.
In either of these cases there will be 2 entries in the legend.
I hope I'm on the right track for you however I can't test this at the moment.
I just did this a little bit ago for a pie chart but not with colors. Do you have to have the colors be shown or could you set a custom array of colors up and reference that instead?
In my problem I had to list 'ranges' of percentages occurring. (Someone wanted things in a range to be counted instead of individual counts).
I created a dataset 'DataforPie':
Declare #temp table ( id int identity, name varchar(8), perc decimal(2,1))
insert into #temp values ( 'Brett', .9),( 'Brett', .5),( 'Brett', .4),( 'Brett', .3)
,( 'John', .1), ( 'John', .3),( 'John', .4),( 'John', .2)
,( 'Brian', .5), ( 'Brian', .6),( 'Brian', .5),( 'Brian', .3)
select *
from #temp
I then set up a pie chart with the 'values' being [count(perc)] and an expression for the 'grouping' and 'labeling' of a 'Category Group' defined as:
=Switch(
Fields!perc.Value >= 0.6, "Greater than 6",
Fields!perc.Value >= 0.3, "Greater than 3",
Fields!perc.Value >= 0, "Greater than 0"
)
Now with your issue since you want custom colors I think you may wish to define a palette expression to determine colors. There is a good example of this here, even if it is a previous version it should still be similar: http://www.cubido.at/blogs/Lists/Posts/Post.aspx?ID=1256
I was in a similar problem and I solved it using the following steps:
Add the mentioned value field in the series group section
Right click the added series group and select series group properties
Add an expression in the Label Field e.g =IIF(Fields!abc.Value<=10,"TenOrLess",...)
In the fill section select gradient and select "No Color" in Color and set an expression in the Secondary Color e.g. =IIF(Fields!abc.Value<=10,"Red",...)
Click on series and in its properties window under the CustomAttributes section set DrawSideBySide to False