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',
IF(YEAR([Date]) = '2014',
IF(YEAR([Date]) = '2015',
IF(YEAR([Date]) = '2016',
Any help would be much appreciated. Perhaps I'm going about the coloring the wrong way.
Re: Creating Color Expression for Years on Line Chart
Year(Date) returns a number, not a string. So remove the single quotes around the year values. Also make sure that Date really is a date field and not a field with values that look like dates but are really just strings.