Getting Value of Y-Axis Max in SSRS - sql-server-2008

I was wondering if there was anyway to set a value of a data point on a graph equal to the Max auto generated Y-Axis Value. I have a line chart that i display a single vertical stripLine on for a particular date, but i want that stripLine to go all the way to the top of the chart. The best I was able to do is set the value to the Max value in the dataset, which works alright, but doesn't render as i'd hope.
i'd like the vertical black line to extend to the top. I know I can set the value of that to Max(Fields!Demo.Value) + 10000 and it extends up another 10000, but that usually increases the y-axis max value causing the same spacing issue. Also, sometime the values are much smaller such as 1000 being the max as opposed to 10mil like in the above graph.
The only other thing I could think was just a clunky IIF statement saying
if Max(value) > 1,000,000
add 100,000
else if Max(Value) < 1,000,000 and Max(Value) > 500,000
add 50,000
etc...
I understand it'd be in a long IIf() statement, i can figure that out, just seeing if there was any other way by going through the determined y-axis max.

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 limit axis value

I want to limit the max value of the vertical axis to 100 % and not 101%.
I have tried setting the axis limit to 100 but that did not help either. Changing that to 100.05% just changes the axis label but the line does not jump to the top of the chart. Is there a way to restrict the high value of the axis to a particular number?
Follow up question: I see this in ChartDataLabel. What does this mean =IIF(Fields!Reliability.Value >= 100, "", Fields!Reliability.Value) ?
To do what you want, while in design mode, right-click on the axis and choose Vertical Axis Properties. Set the Minimum and Maximum values to what you want.
Now, it sounds like that is something you have already tried, but didn't like the results. Another thing you can do is use the values from the data set, along with an expression, to set the min and max values for the axis. So, instead of setting the min and max values manually, you can try something like the following. This assumes the value you are charting is Fields!Reliability.Value.
Minimum: =Min(Fields!Reliability.Value)
Maximum: =Max(Fields!Reliability.Value)
If you want a little bit of a buffer above and below the value line, then you can add and subtract from those values like this:
Minimum: =Min(Fields!Reliability.Value)*0.95
Maximum: =Max(Fields!Reliability.Value)*1.05
Adjust these as desired.
To answer your follow up question about the ChartDataLabel.
=IIF(Fields!Reliability.Value >= 100, "", Fields!Reliability.Value)
This expression sets the ChartDataLabel to an empty string if the Fields!Reliability.Value from the data set is greater than 100, otherwise it uses whatever value is in Fields!Reliability.Value.
Hope this helps you out.

SSRS - Major/minor gridlines spacing

I have an SSRS report with a bar chart with multiple series by CountryName Category group. What I want to do is have gridlines which split each country like below:
However in SSRS the major gridlines seem to interval with the line in the middle of the country name when the grid interval is set to 1 like below:
Can someone point me in the right direction into how to rectify this?
Also is there a way of adding the X axis in SSRS to start from zero like I have in my first graph?
Thanks
You can do it, there is an offset property on the grid lines (horizontal and vertical are separate). Click one one of the gridlines and look in the properties pane. Change the offset to 0.5.
Gives you this.
I'm not sure what you meant about starting from zero on the X-Axis, you have negative values so you'll start from a negative number. If you meant you wantde zero aligned to the middle. You can do that to. You need to set the min and max values of the horizontal axis to the following
Min Value:
=MAX(ABS(Fields!MyValueField.Value), "MyDataSet")*-1
Max Value will be:
=MAX(ABS(Fields!MyValueField.Value), "MyDataSet")
Basically we take the ABSolute largest value and use that as the extent (*-1 for the min value). The problem is that zero might not show so you'll have to play around with the Axis properties maybe to get that working. I'm sure it's possible but I don't have time to test at the moment.
My test data is not great as the number are large

Percentages in SSRS Chart

EDIT: The chart is fixed when I use a stacked chart instead of a stacked percentage chart, but this still doesn't tell me what is wrong with using the percentage chart.
I have a stacked percentage chart which is going from 0 to 10000% instead of 0 to 100%. It appears as if the values are formatted correctly (they add up to 1.01 due to rounding), and even dividing all the values by 100 in the query does not change it.
This is how the chart renders:
with the following Vertical Axis Properties:
I have a table below (with identical number formatting but with 2 percentage points), however that displays as expected:
Finally, here is the raw data set with an additional sum column not reflected in SSRS:
Has anyone come across this issue before? If I manually set the range of the chart from 0-100% (0-1) I can only see that bottom blue series.
Yep. I've seen exactly this. The numbers that the percent chart axis generates are in the range 0 to 100. But when you apply the number formatting as a percent, then the numbers are multiplied by 100 for display.
The trick to fix/work around this is to set the display format to only add the percent sign, not really format the number as a percent. Happily, this requires just one character:
In the Number format for the axis, switch the Category to "Custom." If you just switched from Percentage, you will see something similar to 0%.
Insert a backslash before the percent symbol: 0\% to indicate that you need a literal percent symbol, not to format the number as a percent (multiplied by 100.)
Voila.

Chart issues with SSRS

I am having a problem with getting a stacked area chart to display the right data in SSRS 2005.
On my Y axis, I want a scale from 50% to 100%.
On my X axis I have a set of dates formatted in a style that was necessary for the report (so varchar).
My data consists of 3 data fields which are decimal numbers and contained between 0 and 1, each with a specific date.
My problem is the scale of the Y-axis. I have set the maximum value to 100, the minimum to 50, the interval to 5, and the format to "p" for percentages.
On the preview in the layout tab, this all appears fine (Y-axis starting at 50% up to 100%).
However whenever I generate an actual report it goes from 5000% to 10000% for some reason. I have no idea how this is happening and it completely ruins the report.
I have tried tinkering in the properties for several hours but to no avail.
If this has happened to anyone and they have found a solution, or if anyone has any suggestions I would be very grateful.
Thanks.
When you use percentages, everything factors by 100.
If you want to format and display a value as 50% , it needs to be 0.5 unformatted. Percentages are therefore values between 0 and 1.
Excel and pretty much every other tool works that way.
If your values are all stored as percentages already, then you might just want to append the % symbol at the end of your values. Or better, divide everything by 100.
50 per cent means just that anyway; it means 50 per hundred (cent means 100) so 50/100 is another way of writing 50%.