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: 
jim_chan
Specialist
Specialist

how to add color in pivot table.

Hi guys,

I have created a pivot table.

The requirement is - Only when i select rank number, then in the pivot, only the selected one will be appeared with background color.

When i unselect or clear all, the pivot will remain in white background.

I think i have missed out some condition perhaps? i have tried under my rank no. expression, background color, add in only(green), obviously, it will shows me green.

example.jpg

Rgds,

Jim

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Use something like this in the background colour expression:

=If(Index(GetFieldSelections([Rank No.], '|'), Column(1)), Green())

(I assume [Rank No.] is the name of the field)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

6 Replies
Anonymous
Not applicable

Hi Jim,

Try GetFieldSelection() function as a condition in background color.

Rgds,

Pooja

Chanty4u
MVP
MVP

try in Exp bg colour

am not sure try

=If(getselectedcount(urexp)>0,Green(),white())

jonathandienst
Partner - Champion III
Partner - Champion III

Use something like this in the background colour expression:

=If(Index(GetFieldSelections([Rank No.], '|'), Column(1)), Green())

(I assume [Rank No.] is the name of the field)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jim_chan
Specialist
Specialist
Author

Dear Jonathan,

Thanks for ur expression!  almost there!!

What if I need to put 1 color for each of the rank? what would be the best way to do it?

assuming rank 1 is green, rank 2 is yellow, rank 3 is blue. but if i have 20 ranks??

any possible way that i can add in auto color or something ?

Rgds

Jim

stabben23
Partner - Master
Partner - Master

Hi,

to use different color may be difficult, but you can use one color With different shade.

test With ARGB like argb((7*(sum(Num)/sum(Total Num))) ,0,120,0) ARGB holds 4 parameters, and the first one is shade.

this example will gives me green in differnet shade.

jim_chan
Specialist
Specialist
Author

i have used another workaround. creating another inline add in color column with index(1-3) , it will provide me different color, according to the index.