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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
schivet
Contributor III
Contributor III

Conditional Background color in Expression

Hi,

This sounds like a simple problem but I can't manage it .

I would like to get this directly in my object:

I need to have a different background color when the amount is different to the other ones, knowing that the sum for Source 1 can be only the sum of one row when Source 2 can be a sum of several rows:

Name

Curr

Source

Amount

Article 1

EUR

Source 2

850

Article 1

EUR

Source 2

-850

Article 1

EUR

Source 4

-850

Article 1

EUR

Source 1

1 592

Article 1

EUR

Source 2

1 592

Article 1

EUR

Source 3

1 592

Article 1

EUR

Source 4

1 592

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi Stephane,

Try this as your colour expression:

=If(Sum(Amount)<>Mode(TOTAL <Name> Aggr(Sum(Amount),Name, Source)), LightRed())

Name Source Source 1Source 2Source 3Source 4
Article 1 159215921592742
Article 2 800159215921592

This colours the cell if the value differs from the most common value for that Article.

Cheers

View solution in original post

4 Replies
swuehl
MVP
MVP

Maybe try a background color expression like

=If(Sum(Amount) <> Only({<Source = {'Source 1'}>} TOTAL<Name, Curr> Amount), LightRed())

schivet
Contributor III
Contributor III
Author

Hi Swuehl!

Thank you! That's a really good start but won't work all the time because Source 1 is not alway the reference... I have added an example here when Source 1 is not the correct value and should be the one in color and not the others:

2015-11-24_Image 002.jpg


Any idea?

Thanks for your help

swuehl
MVP
MVP

Try a background color expression like

=If(Sum(Amount) <> Mode(TOTAL<Name,Curr> Aggr( sum(Amount),Name,Curr,Source)), LightRed())

effinty2112
Master
Master

Hi Stephane,

Try this as your colour expression:

=If(Sum(Amount)<>Mode(TOTAL <Name> Aggr(Sum(Amount),Name, Source)), LightRed())

Name Source Source 1Source 2Source 3Source 4
Article 1 159215921592742
Article 2 800159215921592

This colours the cell if the value differs from the most common value for that Article.

Cheers