0

I have a stacked column chart in SSRS that displays data by hour. Included in this data is the meters reading, kVa, Average Temperature and Heat Index for that hour. For some reason, the legend items for the temperature values and the kVa are being repeated for each meter in the dataset. I would like for my legend to have the following values: kVa, Average, Heat Index and each meter number. I included a sample of the chart, the chart data configuration as well as some sample data below. Any idea how I can accomplish this? Please let me know if any other information is required.

Chart Sample

Chart Configuration

Sample Data

4 Answers 4

3

Here is a good solution which covers all possible scenarios

  1. go to "Report Properties" (right click in the blank area)

  2. go to variables and add a new variable called myflag, set the value to "true" and deselect Read-Only

  3. go to the "Series Properties" and then to "Legend" and click the expression button next to "Do not show this series in legend"

Type or paste this code:

=IIF( Variables!myflag.Value = true, false, true )
=Variables!myflag.SetValue( false )

and that's it.

hint

You can use the same variable in the same series' visibility expression without the setting part in the second line to avoid overlapping the drawing of the same series on the chart

2
  • I tried this out and I like it. I'll point out that, in my case, I had to create a variable for each series I needed to do this for and to deselect read only when creating the variable. Otherwise, I think this is a better way of handling this. Mar 17, 2016 at 17:31
  • @BrianSwart that's is the downside, but at least it will work fine. I assume you can use the same variable for all series if you know their rendering order and reverse the condition and set the flag to true in the next. I hope Microsoft pays more attention to SSRS, it's a mess in the current state.
    – CME64
    Mar 18, 2016 at 18:53
1

I couldn't get either of these answers to work for me. Ended up using RowNumber and CountRows in the expression for Do not show this series in a legend property.

=IIF(RowNumber("Dataset")=CountRows(),false,true)
0

You're getting one set of legend values per series you've added. For each series besides the one whose legend you want to keep visible, right click the series (each top-level row in the "Values" box), choose Series Properties, go to the Legend tab, and check "Do not show this series in a Legend."

1
  • Doing that won't show the value in the legend at all. For example, I still want "Average" displayed in the legend but I only want it displayed once. Currently it is being displayed once per meter in the data. Sep 22, 2014 at 18:53
-1

I was able to fix my issue using information from this question on stack overflow: https://stackoverflow.com/a/1867343/965213

  1. Go to the Legend page of the series properties you want to include in the chart.
  2. Edit the function for the "Do not show this series in a legend" property.
  3. Use this formula: =IIF(Fields!SerialNumber.Value=Last(Fields!SerialNumber.Value,"MeterDetail"),false,true)

Now the series will only be repeated once instead of once per series group.

Hope this helps!

3
  • this answer is absured, it assumes that no value will equal the last in the series
    – CME64
    Mar 1, 2016 at 10:00
  • @CME64 Care to offer a better solution if mine is so "absurd"? It worked for the poster of the question I linked to in my answer and it worked for me given the sample data I provided. I would be happy to mark a better answer if it in fact helps. Mar 2, 2016 at 0:06
  • I have posted my answer, I hope it helps. I apologize if my comment was too harsh, I was angry at the answer which I found everyone on the internet using and no other answers were provided and the answer didn't consider the chance of having a matched value between any of the series' and the last in the series so I had to improvise afterwards.
    – CME64
    Mar 16, 2016 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.