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

Conditional color in table box

Hi all,

my tablebox looks like the following:

ProductDiscount
A0.3
B0.19
A0.34
A0.2
B0.11
B0.14

and so on..

Now I would like to color the highest 30% discount values in red. But not the highest 30% of all products combined, but for every product individually. So in this example the 2nd and 3rd row (highest % of A and B) should be red, and not 1st / 3rd.

Hope my concern is clear.

Thank you in advance. Best regards!

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Hi Ludwig,

    Please find attached. I used a straight table with dimensions Product and Discount. Under the Background Color and Text Color for the dimension Discount, I used the following expressions:

For the max Discount only:

Background Color:

=if(Discount=max(total <Product> Discount), red())

Text Color:

=if(Discount=max(total <Product> Discount), white())

For the top 30% when the table is sorted by Product, then Discount:

Background Color:

=if(rank(sum(Discount))<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, red())

Text Color:

=if(rank(sum(Discount))<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, white())

For the top 30% when the table is sorted by just Discount Descending:

Background Color:

=if(aggr(rank(sum(Discount)), Product, Discount)<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, red())

Text Color:

=if(aggr(rank(sum(Discount)), Product, Discount)<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, white())

I added some values to the data in order for the top 30% to actually show colors.

Hope this helps!

View solution in original post

8 Replies
Michael_Tarallo
Employee
Employee

Hi Ludwig -

Is this for Qlik Sense or QlikView? - Just want to make sure as the process is similiar, but how you apply it is different.

please let us know.

Mike

Regards,
Mike Tarallo
Qlik
Not applicable
Author

I'm sorry I mixed that up. This is for QlikView!

Ludwig

Michael_Tarallo
Employee
Employee

Hi Ludwig - OK - I will move this to the appropriate forum.

In the mean time - check out this video that may help you with conditional styling in QlikView.

Qlikview Pivot with Conditional Formatting by RFB 16 - YouTube

Please mark the appropriate replies as helpful / correct so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike

Regards,
Mike Tarallo
Qlik
Not applicable
Author

Thanks .. Much helped!

Not applicable
Author

Thank you for the link, but unfortunately it does not solve my problem.

As I mentioned, I do not want to color the overall lowest values, but the lowest values for each product individually.

Is it clear what I mean? Thank you for your help !

Not applicable
Author

Anyone to help me?

Thank you!

jerem1234
Specialist II
Specialist II

Hi Ludwig,

    Please find attached. I used a straight table with dimensions Product and Discount. Under the Background Color and Text Color for the dimension Discount, I used the following expressions:

For the max Discount only:

Background Color:

=if(Discount=max(total <Product> Discount), red())

Text Color:

=if(Discount=max(total <Product> Discount), white())

For the top 30% when the table is sorted by Product, then Discount:

Background Color:

=if(rank(sum(Discount))<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, red())

Text Color:

=if(rank(sum(Discount))<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, white())

For the top 30% when the table is sorted by just Discount Descending:

Background Color:

=if(aggr(rank(sum(Discount)), Product, Discount)<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, red())

Text Color:

=if(aggr(rank(sum(Discount)), Product, Discount)<=max(total aggr(rank(sum(Discount)), Product, Discount))*.3, white())

I added some values to the data in order for the top 30% to actually show colors.

Hope this helps!

Not applicable
Author

This post really helped. Thanks !