问题
I have a dataset that contains data in below format: The graph you see on the right is a Line chart that is being used in SSRS report. This is the sample data you see in here below. The graph in SSRS report contains month wise data (as oppose to day wise here) I need to set the axis dynamically (Y-Axis numbers) so that when the numbers get changed the said graph is also updated without updating the Y-Axis manually.
I know I can set the vertical axis property of line chart and then go to "Minimum" and write an expression to bring minimum of one column but I am not sure how to handle MIN function for 3 columns (i.e. Under 5 years, 5-10 years and 10+ years)
TL;DR: I need to change vertical axis to bring MIN -5 values for Last 3 columns combined (in below chart) and MAX +5 values for again those columns. hence MIN should be -5 (i.e. 0-5) and MAX should be 48 (43+5)
回答1:
I am assuming that setting the Y Axis min and max values to Auto does not work for your situation for whatever reason?
There may be a better way of doing this but this is what I thought of...
=
IIF(
IIF(
MIN(Fields!ColA.Value) < MIN(Fields!ColB.Value),
MIN(Fields!ColA.Value),
MIN(Fields!ColB.Value)
)
< MIN(Fields!ColC.Value),
IIF(
MIN(Fields!ColA.Value) < MIN(Fields!ColB.Value), MIN(Fields!ColA.Value),
MIN(Fields!ColB.Value)
)
, MIN(Fields!ColC.Value)
) -5
and...
=
IIF(
IIF(
MAX(Fields!ColA.Value) > MAX(Fields!ColB.Value),
MAX(Fields!ColA.Value),
MAX(Fields!ColB.Value)
)
> MAX(Fields!ColC.Value),
IIF(
MAX(Fields!ColA.Value) > MAX(Fields!ColB.Value), MAX(Fields!ColA.Value),
MAX(Fields!ColB.Value)
)
, MAX(Fields!ColC.Value)
) +5
来源:https://stackoverflow.com/questions/65653638/how-to-set-dynamic-axis-unit-in-ssrs-reports