Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Background color in pivot table

Hi.

I have a pivot table with two dimensions, YearMonth and SystemCode. I use the following expression to get rolling 13 for some system codes and it works fine:

count({$<PeriodCounter={">$(#=max(PeriodCounter-14))<=$(#=max(PeriodCounter)-1)"},SystemCode={'114','744','746','113','992','118','121','125'}>} SystemCode)

But I would like to add background colors (red/green) if the system codes are over or under goal. The issue is that the system codes I use have differnt goals.

I tried to create a if-statement for the background color for the expression like (below only example for system code 114):

if(count({$<PeriodCounter={">$(#=max(PeriodCounter-14))<=$(#=max(PeriodCounter)-1)"},SystemCode={'114'}>} SystemCode) < only({$<PeriodCounter={">$(#=max(PeriodCounter-14))<=$(#=max(PeriodCounter)-1)"},KPI_Heading={"Goal_114"}>} KPI_Value), RGB(68,185,68),RGB(226,83,83))  

This gives me a pivot table with all the system codes and not the correct color on system code 114.

Is there anyone that have some suggestions?

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You probably need a pick-match combination in your expression:

pick(match(SystemCode,114,744,....,125)

   , if(count(${<PeriodCounter= ... >}SystemCode)< only({<...>}KPI_Value), rgb(...), rgb(...) ) // SystemCode 114

   , if(count(${<PeriodCounter= ... >}SystemCode)< only({<...>}KPI_Value), rgb(...), rgb(...) ) // SystemCode 744

   , ....

   , if(count(${<PeriodCounter= ... >}SystemCode)< only({<....>}KPI_Value), rgb(...), rgb(...) ) // SystemCode 125

)

Can you post an example document?


talk is cheap, supply exceeds demand
Not applicable
Author

I have attached an example where you can find the first pivottable that is correct but without background color and the other table I have start with pick(match...) but it doesn't that well.