
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Background Color Expression in a Table
Greetings Community,
I am in need of some expertise. I have a table that has four categories of completion status (Did Not Attend, Not Completed, Completed, and Partially Completed) that I am trying to color code to show red for did not attend, yellow, for not completed, green for completed, and gray for partially completed. The issue is I tried doing an IF statement putting commas in between each statement and I get nothing back. I tried writing it with just for the red and it worked. Everything else it would do nothing. Please help.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Anonymous ,
Thanks for posting.
On the Background color expression of the field have you put something like:
if(AsciiNum = 32, red(),
if(AsciiNum = 33, yellow(),
if(AsciiNum = 34, green(),
if(AsciiNum = 35, black(),
white()
)
)
)
)
For you should be like:
if([Completion Status] = 'Did Not Attend', red(), if([Completion Status] = 'Not Completed', yellow(), if([Completion Status] = 'Completed', green(), if([Completion Status] = 'Partially Completed', lightgray(), white() ) ) ) )
Qlik Sense color functions
The following color functions can be used in expressions when coloring by expression.
- black()
- darkgray()
- lightgray()
- white()
- blue()
- lightblue()
- green()
- lightgreen()
- cyan()
- lightcyan()
- red()
- lightred()
- magenta()
- lightmagenta()
- brown()
- yellow()
Cheers,
Albert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using this data:
CompletionStatus:
load * Inline [
Row,CompletionStatus
1,Not Completed
2,Completed
3,Completed
4,Completed
5,Not Completed
6,Completed
7,Not Completed
8,Partially Completed
9,Did Not Attend
10,Completed
];
This formula in the "Background color express"
=If(CompletionStatus = 'Did Not Attend',Red(),
If(CompletionStatus = 'Not Completed', Yellow(),
If(CompletionStatus = 'Completed',Green(),
If(CompletionStatus = 'Partially Completed',rgb(105,105,105)))))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the assistance Albert. I discovered where I went wrong when doing my if statements is that I did not include the () after my colors. --Cheers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great @Anonymous , glad we could help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Anonymous ,
Thanks for posting.
On the Background color expression of the field have you put something like:
if(AsciiNum = 32, red(),
if(AsciiNum = 33, yellow(),
if(AsciiNum = 34, green(),
if(AsciiNum = 35, black(),
white()
)
)
)
)
For you should be like:
if([Completion Status] = 'Did Not Attend', red(), if([Completion Status] = 'Not Completed', yellow(), if([Completion Status] = 'Completed', green(), if([Completion Status] = 'Partially Completed', lightgray(), white() ) ) ) )
Qlik Sense color functions
The following color functions can be used in expressions when coloring by expression.
- black()
- darkgray()
- lightgray()
- white()
- blue()
- lightblue()
- green()
- lightgreen()
- cyan()
- lightcyan()
- red()
- lightred()
- magenta()
- lightmagenta()
- brown()
- yellow()
Cheers,
Albert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using this data:
CompletionStatus:
load * Inline [
Row,CompletionStatus
1,Not Completed
2,Completed
3,Completed
4,Completed
5,Not Completed
6,Completed
7,Not Completed
8,Partially Completed
9,Did Not Attend
10,Completed
];
This formula in the "Background color express"
=If(CompletionStatus = 'Did Not Attend',Red(),
If(CompletionStatus = 'Not Completed', Yellow(),
If(CompletionStatus = 'Completed',Green(),
If(CompletionStatus = 'Partially Completed',rgb(105,105,105)))))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the assistance Albert. I discovered where I went wrong when doing my if statements is that I did not include the () after my colors. --Cheers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great @Anonymous , glad we could help!
