2

screensdhot

I have the above barchart with the following expression under the following section:

SERIES PROPERTIES > FILL > EXPRESSION

=iif(Fields!classification.Value="RFC","#56ca29","#ff6969")

This works fine in terms of putting green for all the RFC's and RED for all the Projects on the bar chart however the LEGEND is red for both. I have no idea why this is as I have a similar chart above which uses the same expression and works fine.

2 Answers 2

1

Due to having the expression used in an above bar chart it was discovered that this was causing issues.

By simply re-arranging the expression from:

=iif(Fields!classification.Value="RFC","#56ca29","#ff6969")

to

=iif(Fields!classification.Value="Project","#ff6969","#56ca29")

This meant that the expression was unique and not clashing with the above - same results just with a fully functioning legend.

1

Note that the Answer stated above to this problem is only a workaround for the problem - the difference in how the Legend determines the fill color for the 1st series vs. how the chart column fill colors is still present under the covers, but thanks to the catch-all ELSE clause matching the 1st data series is no longer exposed in the report.

I had a similar issue but needed more than 2 colors, hence used the Switch function instead - i.e. an expression similar to: =Switch(Fields!classification.Value="Project","#ff6969", Fields!classification.Value="RFC","#56ca29", Fields!classification.Value="RFC","#33ee22", True, "Red")

The last switch condition "True" is a catch-all for any values that do not match the listed ones. I found however that the first Legend entry was always falling back to the RED catch-all, even though it was in the Switch list (e.g. "Project").

This (undesirable) behaviour is consistent with the stated answer to this problem - i.e. by ensuring the first Legend entry matches the ELSE "catch-all" part of the iif() function then the Legend will correctly display the colors.

This means that in our case we cannot have a catch-all RED fill color, and need to change "Red" above to match the desired color for the first (hopefully always present) Legend entry.

Piquet

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.