Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Qlik Launches Open Lakehouse and advanced agentic AI experience in Qlik Answers! | LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Mr_Pearl
Creator II
Creator II

Qlik Sense - Background color expression not working as expected?

Within Chart --> Table I am trying to highlight rows based on the content (string) like below table. By using following expression within "Background color expression"

If(Product='Apple', Yellow(), If(Product='Samsung', Green(), If(Product='Google', Blue(), Red())))

Mr_Pearl_1-1631764058491.png

 

However, I get below output,

Mr_Pearl_2-1631764123292.png

 

If I use my calendar to display only August and July then I get below output,

Mr_Pearl_3-1631764211896.png

 

Meaning only the latest month is getting displayed with right colors. I don't know what am i missing here. Can someone please help. I tried using Pick and match functions but still getting same result.

 

Labels (2)
2 Solutions

Accepted Solutions
rubenmarin

Hi, it would be great if we can have a sample to check, looks like something is filtering for the last month.

You can try with: If(Only({1} Product)='Apple', Yellow()... but it's just a guess.

View solution in original post

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Mr_Pearl 

Do you have another column in the table with a calculation? Is there set analysis in that column, showing months that are outside of the current selections?

If that was the case then I would expect the colour expression to behave as you have there.

Code something like this might then fix up the issue:

If(maxstring({1}Product)='Apple', Yellow(), If(maxstring({1}Product)='Samsung', Green(), If(maxstring({1}Product)='Google', Blue(), Red())))

You might also want to define your own colours, using the rgb function, as the stock ones that use the colour name functions are not always great.

Hope that helps.

Steve

View solution in original post

6 Replies
rubenmarin

Hi, it would be great if we can have a sample to check, looks like something is filtering for the last month.

You can try with: If(Only({1} Product)='Apple', Yellow()... but it's just a guess.

vikasmahajan

try with this 

Pick(WildMatch(Product, 'Apple', 'Samsung', 'Google'),'Yellow()', 'Green()', 'Blue()', 'Red()')

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Mr_Pearl 

Do you have another column in the table with a calculation? Is there set analysis in that column, showing months that are outside of the current selections?

If that was the case then I would expect the colour expression to behave as you have there.

Code something like this might then fix up the issue:

If(maxstring({1}Product)='Apple', Yellow(), If(maxstring({1}Product)='Samsung', Green(), If(maxstring({1}Product)='Google', Blue(), Red())))

You might also want to define your own colours, using the rgb function, as the stock ones that use the colour name functions are not always great.

Hope that helps.

Steve

Mr_Pearl
Creator II
Creator II
Author

Thank you @stevedark Your solutions works too.

 

Mr_Pearl
Creator II
Creator II
Author

Thank you for your time @vikasmahajan . I tried this before but didnt work.

Zaouja11
Contributor
Contributor

its works for me thank you rubenmarin