Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Hi Kenneth,
Make use of the colormix() function to create complex colour coding expressions
https://www.youtube.com/watch?v=YasIe3VUJrg
Thanks,
Sangram.
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.