There's moreā€¦

The red and green indicators used in the preceding image can be useful for spotting products that are not performing in line with similar products. To get more value from these types of indicators, we can change the density of the color to reflect the magnitude of change. Replace the color expression we used in step 7 of the How to do it... section with the following code:

If((Sum({<Year={2015}>}Sales)- 
Sum({<Year={2014}>}Sales))/Sum({<Year={2015}>}Sales)>0,
ColorMix1((Sum({<Year={2015}>}Sales)-
Sum({<Year={2014}>}Sales))/Sum({<Year={2015}>}Sales),
white(),RGB(50,255,50)),
if((Sum({<Year={2015}>}Sales)-
Sum({<Year={2014}>}Sales))/Sum({<Year={2015}>}Sales)<0,
ColorMix1(fabs((Sum({<Year={2015}>}Sales)-
Sum({<Year={2014}>}Sales))/Sum({<Year={2015}>}Sales)),
white(),RGB(255,50,50))))

The chart should now resemble the following screenshot:

Based on the values returned by the expression, the ColorMix1 function automatically assigns a range of colors. In the preceding example, we set up two color ranges: the first If statement goes from white to green for the positive numbers and the second goes from white to red for the negative numbers. The ColourMix1 function only works with positive numbers, so we use the Fabs function to convert the negatives into positives once they are identified by the second if statement.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset