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

Top 5 and Bottom 5 bar chart in color

Hi,

I was trying to create a bar chart that displays the top 5 employee in Green and the bottom 5 employee in Red color in one chart. I have one dimension (Employee) and the expression is the utilized hours that used by employee in percentage. Can anybody please tell me how to do it?

I was using the following in expression Background color:

'If (Rank(Sum(vTotalUtilization)) <6, Green(), if (Rank(Sum(vTotalUtilization)) > 5, Red())), but it turns out every bar's in Red color.

Please help.

Thanks

14 Replies
wossenhh
Creator
Creator
Author

Thanks a lot Carlos!

cfz
Former Employee
Former Employee

Please close the thread if you are happy with the answer.

sebastiandperei
Specialist
Specialist

First, the easiest way is:

if(RowNo()<=3,Green(),if(RowNo()>=NoOfRows()-3,red(),Black()))

Second: Please, dont' forget to mark answers as "Useful" or "Answered". Please, read the forum rules.

wossenhh
Creator
Creator
Author

Hi Carlos,

I have to come back again with some questions. Here below is the data's from your examples. I added couples of data's with zero's and QV doesn't show me the bottom 5 correctly.

R - 32          X - 5          K - 1

D - 11          L - 4          E - 0

J - 9            F - 3          H - 0

Y - 8            N - 3          I - 0

B - 8            A - 2          M - 0

C - 6            G - 2          P - 0

As you can see from QV, the top 5 are correct which are R - D - J - Y - B, however the bottom 5 shows as

A - G - K in stead of showing F - N - A - G - K . Any help please?

Thanks,

Wossen

Not applicable

use this:

if(RowNo()<=5,rgb(8,64,129),if(RowNo()>=NoOfRows()-4,red(),Black()))