Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem combining Line Color and Set Analysis

I've got a Line chart that uses a Set Analysis expression such as:

sum({1<Year = {$(=Max(Year)), $(=Max(Year)-1),  $(=Max(Year)-2)}>} Sales)

What I would like is to colorcode the years so that I can re-use the same colors for the same years in other objects. If I try something like:

If (Year = 2005, red(),
If(Year = 2006, green(),
If(Year = 2007, blue(),
If (Year = 2008, yellow())
)
)

)

it only works if i explicitly select the three years in the fieldbox. But if I only select for example year 2007, the linechart would still show me lines for sales in three years (2007, 2006 and 2005) but since I've only explicitly selected year 2007 that's the only year that would be correctly color-coded.

Any ideas how to correctly colorcode this situation?

1 Reply
Not applicable
Author

Not the same data as you, but try the following syntax

=

if(only({1} Year=2010),rgb(255,0,0),
if(only({1} Year=2011),rgb(150,150,150),
if(only({1}Year=2012),rgb(0,0,255))))