SSRS colour expression for upward downward trend line chart - reporting-services

I need to make a line chart with the month on horizontal axis and a value on the vertical axis.
I need to colour the line's segments in green if the trend based on the previous month is growing, or in red if the trend is decreasing.
I can't find a way to compare the values grouped by month, and I prefer not to perform this by adding another query from db.

Right-click on the Chart Series (the line of the graph) and select Series Properties..., click Fill on the left then click the fx button to enter and expression for the fill. Let's say your field is called Sales. Use the following expression for the Fill:
=IIF(Fields!Sales.Value >= Previous(Fields!Sales.Value), "Green", "Red")
This worked on my simple test. You may need to aggregate within your query (group by month and sum) for this to work properly.

Related

SSRS range bar chart, different color when no data

I am looking to change the color in the "gaps" in the range chart that I have built.
Essentially I am trying to build a visualization for the staff to see the availability on bays. The red markings mean the bay is booked, I wanted green then to be in between the red to highlight free bays.
Occupied bays:
I suspect I need to go back to my dataset and add in some date tables to show "null data" to allow a "switch" to work, but I thought someone might know if I could change this without going this way.
An example of the dataset would be:
Following up
here is a screen shot of my output, i added data labels to see if i was going wrong...HOWEVER I also added shadows to my data and my data is actually still there, just hiding behing my secondary bars......
you are right about my data set, i had to add a series grouping to get my appointments all to appear other wise i was just getting the first appointments on the row only to appear....
Following up 2
A further follow up, I have followed #iamdave 's excellent RangeChart.RDL
I have applied my dataset to it but I am now getting the following output, I know I am probably missing something simple, my gut is telling me the cust_id are seperating all the appointments on to seperate lines yet I have both the primary and secondary axis set to "DrawSideBySide = False"
Here is my set up..
here is my latest output, if I could just group all the rows/bars/lines down to the 6 bays it would be great.
You can do this by adding in another data series based on your original dataset, that will require significantly less processing than filling in all your empty periods as suggested by WEI_DBA.
In your dataset, add a new column that returns dense_rank() over (order by BAY) as BayID (order by should be your desired axis label).
This may be best done as a wrapping select statement to preserve the rest of the query logic as is.
In your Range Chart, add in another Values item, with the same Category Field as your current one.
Set the Top Value to 1 and your Bottom Value to 0.
You could also set this to the min and max time of your dataset or the start and end period of your report to only cover the period the Bay was available.
Set it to display on the Secondary Axis for both Vertical and Horizontal axes.
Also select the Do not show this series in a legend option.
Set up the Secondary Vertical Axis in exactly the same way as your Primary Vertical axis.
Set the Secondary Horizontal Axis Minimum and Maximum to the same values as your Bottom and Top above.
Hide both the Secondary Axes.
Select the new Values item and in the Properties window, expand the CustomAttributes section and change DrawSideBySide to False.
If necessary, adjust the order of the Values items in your Chart Data window to make sure the new Range Bar displays underneath your actual data.
Select the original Values item and in the properties sidebar navigate to Data > DataPoint:
Change AxisLabel to =Fields!BAY.Value (Your axis label).
Change Values > X to =Fields!BayID.Value (Value from point 1.).
You should now have a range chart that that displays your data on top of a solid bar, that you can set to any colour you require:

ssrs chart axis labels duplicated

I am trying to get my chart to only show the month name. I have changed the horizontal axis options to do that but they are all duplicated. Can anyone tell me how I can get this set up to only show each month one time?
Here is the chart without any formatting:
It correctly shows the 4 data points.
I then go to the Horizontal Axis properties, change it to number and then select the MMM for the three character month name which correctly displays:
when I run the report after making that change I get an extra month (december) and all the month names are duplicated:
What do I need to do so that I only get Jan - Apr one time on my horizontal axis?
Thanks for any suggestions!
Leslie
edit: Here is the raw data:
I have tried changing the interval but have seen no effect on the output. I have tried unselecting the "Always include zero" option to get rid of december but that didn't work either.
edit 2: I said above there was no effect when I changed the axis interval to 1, actually that results in many entries for the Year-Month data in the axis area.
Right click on horizontal axis, select axis property, from the "Axis range and interval", for interval, type in "1" (without quotes), for interval type, select "Month", then hit OK. enter image description here

SSRS combination column and line chart - line width

I've got a chart in SSRS where I have both line and column values.
Is there any way the line can extend out to the extreme left and right of the corresponding column for the month?
The Green line is the target and the orange columns are the Utilisation figures for the months
I've tried Strip Lines but creating the IIF expressions to capture the filtering is too much pain and you can't get varying results by Month.
You could try to stick your line on the secondary X axis and then play with the settings of that axis. Once you get the settings like you want them you can hide the secondary X axis from the chart area.

SSRS Chart. How to plot line to decrease totals by date

I have a chart in SSRS that has dollar totals by date. I would like a line chart that starts with the total dollars and then decreases the total by date until it gets to zero. How can I do that?
Create a Line Chart
In "Chart Data" add the following expression to the "Values" part (with the green plus sign): "=RunningValue(Fields!colVal.Value,Sum,"DataSet1")" where colVal is the field that you want to sum up, and "DataSet1" is the scope
Then right click on the horizontal axis -> Properties -> Side Margin Disabled + Scale Options = Reverse Direction
Hope this helps!

Microsoft Reporting Server Chart x-axis question

I have a simple chart, and on the x-axis I have numbers ranging from 10000 to 10031.
The numbers are from a SQL call, and these values have values, which are plotted on the y-axis, just a simple chart.
The chart is only showing six of the numbers between 10000 and 10031, and having the user figure out the other numbers, I suppose to avoid clutter.
I would like all of the x-axis number to show up, and to fit it will need to be rotated 90 degrees.
I cannot find a setting to make all of the numbers show up.
In "Axis Properties", select "Axis Options" and put in "1" for the expression to show all. "2" will show every other, and the default, "0" will mean for Reporting Services to optimize as it sees fit, usually between every fourth or sixth element.