Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.

cschaeuble_0-1675964253266.png

 

Labels (2)
4 Solutions

Accepted Solutions
Albert_Candelario

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()
)
)
)
)

Albert_Candelario_0-1675975232544.png

 

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

Please, remember to mark the thread as solved once getting the correct answer

View solution in original post

jwjackso
Specialist III
Specialist III

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)))))

color.PNG

 

View solution in original post

Anonymous
Not applicable
Author

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

View solution in original post

Albert_Candelario

Great @Anonymous , glad we could help!

Please, remember to mark the thread as solved once getting the correct answer

View solution in original post

4 Replies
Albert_Candelario

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()
)
)
)
)

Albert_Candelario_0-1675975232544.png

 

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

Please, remember to mark the thread as solved once getting the correct answer
jwjackso
Specialist III
Specialist III

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)))))

color.PNG

 

Anonymous
Not applicable
Author

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

Albert_Candelario

Great @Anonymous , glad we could help!

Please, remember to mark the thread as solved once getting the correct answer