2 Replies Latest reply: Mar 29, 2016 2:14 AM by Gysbert Wassenaar RSS

    Creating Color Expression for Years on Line Chart

    Kenneth O'Brien

      Hi,

       

      I'm having trouble creating a Color Expression to designate a color for each [Date] Dimension on a line chart.  With the data set at hand, the [Date] field is formatted as "MM/DD/YYYY".  Because of this, I had to create separate master dimensions for MONTH (x-axis of the chart), and YEAR (each line on the chart is a specific year from 2013-2016).  For Year, I used = YEAR([Date]), which has worked well.

       

      I run into an issue when using a similar logic to set the Color Expression for each Year (i.e. I want the 2016 line to be X color, 2015 to be Y color, etc.)

       

      Here's the color expression I'm using, which currently creates "misses" for all of the IF criteria, and changes each Year's line to Black... the last resort in the IF statement.  It would be nice if I could have pulled in the Master Dimensions I created, but that doesn't seem to be an option.

       

      IF(YEAR([Date]) = '2013',

      Red(),

       

      IF(YEAR([Date]) = '2014',

      Green(),

       

      IF(YEAR([Date]) = '2015',

      Blue(),

       

      IF(YEAR([Date]) = '2016',

      Yellow(),

       

      Black()))))

       

      Any help would be much appreciated.  Perhaps I'm going about the coloring the wrong way.