reporting services - SSRS Line Chart Dynamic Y Axis -
i have line chart y value set
=countrows() and have category group groups on
=cdate(fields!end_month_nb.value) i trying set interval of y axis dynamically such fractions not appear when range small (see below).

i tried setting interval expression to
=iif(countrows() <= 5, 1, "auto") which works fine if total number of rows less or equal 5, need maximum countrows() return in context of category group.
any idea how accomplish this?
since you're using ssrs 2012, can use aggregate of aggregate functionality achieve this.
say have chart this, similar yours:

with appropriate data, has same issue screenshot, expression in y-axis interval:

i.e. here there 8 rows, expression set auto, because groups have no more 3 rows fractions in y axis.
we can around finding maximum of each of these group counts.
the category group have name:

here i've called monthgroup. this, can change y axis interval expression:
=iif(max(countrows("monthgroup")) <= 5, 1, nothing) i.e. if <=5, interval 1, otherwise pass null value, i.e. let ssrs determine interval.
so we're checking max of category group level countrows; 3 in example we're getting required axis intervals:

edit note:
previously had y axis expression as:
=iif(max(countrows("monthgroup")) <= 5, 1, "auto") but after posting noticed causing warning in circumstances; presumably because auto not valid interval; it's placeholder used ssrs. updated expression:
=iif(max(countrows("monthgroup")) <= 5, 1, nothing) works expected without warnings.
Comments
Post a Comment