# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for
Did you mean:
Contributor III

## How to change background color in pivot table by expression ?

Hi all,

I want to show top 3  in green and bottom 3 in red.

If ( sum ( sales) > .5, rgb ( 255,0,0,))

Which function do I use to return top 3 or bottom 3 ?

4 Replies
Contributor III

Hi Layla,

try:

if(rank(sum(Sales))<=3,rgb(255,0,0), if(rank( - sum(Sales))<=3,rgb(0,255,0))

RS

Contributor III
Author

Hi Rodolfo,

It works but it only returns 3 values in top 3.

I have 4 values that are in the top3 . Any way to fix this ?

Contributor III

Hi Layla,

you mean that the 3rd and the 4th have the same sales amount ? so you want to color those (it doesn't matter how many elements in the dimension) who has the top 3 sales amount.

Contributor III

Hi Layla,

you'll need to use  set analisys, try this:

if( sum(Sales) >= min(aggr(sum({<dim={"rank(sum(Sales))<=3"}>}Sales),dim))

,rgb(255,0,0),  sum(Sales) <= max(aggr(sum({<dim={"rank( -

sum(Sales))<=3"}>}Sales),dim))  , rgb(0,255,0) )

RS

2017-12-05 15:31 GMT-02:00 Layla Mar <qcwebmaster@qlikview.com>:

Tags
Community Browser