Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tinkerz1
Creator II
Creator II

background color on set analysis

Hi,

I can't set the background colour with an expression.

The expression formula switches between set analysis and normal output based on a condition.

=if(getselectedcount([Header])>1,

Sum([Alternate State 1]...<Set Analysis>),

DATA

)

The formula in the background color is

=If(Wildmatch([label_M],'*Red*'),RGB(255,0,0),
If(Wildmatch([label_M],'*Amber*'),RGB(255,191,0)))

And label_M is is a field in the pivot table.

The label_M field in both conditions returns a Red and a Amber field, why won't the colour work when the set analysis condition is true?

Thanks.

1 Solution

Accepted Solutions
sunny_talwar

May be try this for the background color:

=if(not wildmatch(Only({<Company>} Company),'I','H'),RGB(255,0,0),

if(wildmatch(Only({<Company>} Company),'I'),RGB(255,255,0),

if(wildmatch(Only({<Company>} Company),'H'),RGB(0,255,0),

)))


Capture.PNG

View solution in original post

12 Replies
sunny_talwar

Where is set analysis here? Not sure I understand the reference to set analysis

tinkerz1
Creator II
Creator II
Author

This would be the full formula, the set analysis will be triggered if get selectedcount >1

=if(getselectedcount([Issue Owned by])>1,
Sum({[Stats1]<[Issue Owned by]+={"$(=Only(left([Issue Owned by],index([Issue Owned by],'-')-2)))*"}*{"*|All"},[Risk label_M]-={'*Threshold'}>} distinct [Data M])
,
[Data M]
)

tinkerz1
Creator II
Creator II
Author

However the formula to set the background does not trigger if

getselected count >1

=If(Wildmatch([label_M],'*Red*'),RGB(255,0,0),
If(Wildmatch([label_M],'*Amber*'),RGB(255,191,0)))

tinkerz1
Creator II
Creator II
Author

Hi,

I have written a small QVW to explain my problem.

I am using getselectedcount on a field to switch between a set analysis statement and and normal statment.

When just 1 selection from the company field is selected the background colors work but when more than one selection from the company field is selected; then no background color, the set analysis works though.

Please try.

sunny_talwar

May be try this for the background color:

=if(not wildmatch(Only({<Company>} Company),'I','H'),RGB(255,0,0),

if(wildmatch(Only({<Company>} Company),'I'),RGB(255,255,0),

if(wildmatch(Only({<Company>} Company),'H'),RGB(0,255,0),

)))


Capture.PNG

tamilarasu
Champion
Champion

Hi Neil,

You can try background color expression as

=if(Only({1}Company) = 'I',RGB(255,255,0),

if(Only({1}Company) ='H',RGB(0,255,0),

If(Only({1}Company)<>'I' or Only({1}Company)<>'R', RGB(255,0,0))))

tinkerz1
Creator II
Creator II
Author

Thanks for the reply Tamil, however the getselected code was key to this example.

I am using getselected count as a switch. the 2 formulas after are just examples of set analysis and a normal formula.

Thanks for looking into it.

sunny_talwar

Did you look at what I provided? Is this not what you were aiming for?

tinkerz1
Creator II
Creator II
Author

Hi Sunny,

It did not work as the getselectedcount part was removed.

The point of the formula is to set a color when a single company is selected, but when more that one customer is selected then use another color depending on the selection.

The set analysis for more the one could be selecting all companies with an 'I' in the title, but there is only 1  in my list

its really the 'form' of the function not the actual formula