Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a pivot table and I want to color the background of each cell depending on a condition between the value of one column and the other column. I'm using pick like something like this:
=pick(Main_Metrics.FieldCode, if(sum({$< Metric_ID = {1},Metric_Values.Metric_Type = {1}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount)
<=
sum({$< Metric_ID = {2},Metric_Values.Metric_Type = {1}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount)
, ARGB(255,91,143,34), ARGB(255,224,0,52)),
if( sum({$< Metric_ID = {1},Metric_Values.Metric_Type = {2}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount)
<=
sum({$< Metric_ID = {2},Metric_Values.Metric_Type = {2}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount)
, ARGB(130,94,182,228), ARGB(130,94,182,228)),
null(),
if(sum({$< Metric_ID = {1},Metric_Values.Metric_Type = {4}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount)
>=
sum({$< Metric_ID = {2},Metric_Values.Metric_Type = {4}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount), ARGB(255,91,143,34), ARGB(255,224,0,52))
)
Just to have more shortly my code, I'm using variables and it looks something like that:
=pick(Main_Metrics.FieldCode, if($(#V_M1_YTD_PLAN) <= $(#V_M1_YTD_ACTUAL), ARGB(255,91,143,34), ARGB(255,224,0,52)),
if($(#V_M2_YTD_PLAN) <= $(#V_M2_YTD_ACTUAL), ARGB(130,94,182,228), ARGB(130,94,182,228)),
null(),
if($(#V_M4_YTD_PLAN) >= $(#V_M4_YTD_ACTUAL), ARGB(255,91,143,34), ARGB(255,224,0,52))
)
The problem I have is that when I change to variables and do a drilldown, it seems that the value of the variable is always the same at all levels, so the color change is not noticed. However, if I do it without variables the background color is perceptible already.
Please your support, I do not know how to turn it around to solve my problem.
What are you getting when you use below condition. Not sure how Pick you used over here?
if(sum({$< Metric_ID = {1},Metric_Values.Metric_Type = {1}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount) <=
sum({$< Metric_ID = {2},Metric_Values.Metric_Type = {1}, Metric_Values.Year = {2017}, Metric_Values.Period = {"<=$(=Metric_Values.Period)"}>} Metric_Values.Amount) , ARGB(255,91,143,34), ARGB(255,224,0,52))