Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problems coloring the background of a pivot table

 

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.

 

1 Reply
Anil_Babu_Samineni

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))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful