Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have a bar chart that we always want to display 3 years no matter what. If the user picks 2016, we want to show 2016, 2015, and 2014. We also want to have the colors defined. Everything works when either no year is selected, or if 3 years are selected. So if the user picks no year, we see 2016, 2015, and 2014 and the colors we want. If they pick 2016,2015, and 2014 we see all 3 years and the colors we want.
The problem is when the user only picks one year, say 2016. We still see all 3 years, but the colors stop working.
Here is the formula for the always 3 years on the chart:
=Sum({<Year = {$(=Max(Year)), $(=Max(Year) - 1), $(=Max(Year) - 2)}>} AdmBrokrCommBaseAmt)/1000
Here is the formula for the colors. We are using this in the background color expression:
Pick(Match(Year,$(vMaxSelectedYr),($(vMaxSelectedYr)-1),($(vMaxSelectedYr)-2)),RGB(201,187,23),RGB(45,64,199),RGB(34,235,2))
If someone could either provide us with a solution, or help us understand why it doesn't work when only 1 year is selected, that would be great. thanks!
This works, but only for current year of 2016. 2015 and 2014 are still 1 solid color.
=Pick(Match(Only({<Year>} Year), $(vMaxSelectedYr), ($(vMaxSelectedYr)-1), ($(vMaxSelectedYr)-2)),
(if(Market = 'Secondary', RGB(201,187,23), blue())),
(if(Market = 'Secondary', RGB(45,64,199), cyan())),
(if(Market = 'Secondary', RGB(34,235,2),If(Market = 'New Issue',RGB(100,200,210),Green()))))
Try this:
=Pick(Match(Only({<Year>} Year), $(vMaxSelectedYr), ($(vMaxSelectedYr)-1), ($(vMaxSelectedYr)-2)),
(If(Only({<Year>} Market) = 'Secondary', RGB(201,187,23), blue())),
(If(Only({<Year>} Market) = 'Secondary', RGB(45,64,199), cyan())),
(If(Only({<Year>} Market) = 'Secondary', RGB(34,235,2), If(Only({<Year>} Market) = 'New Issue',RGB(100,200,210),Green()))))
Works like a charm, thanks Sunny!
Awesome ![]()