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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
john_duffy
Partner - Creator III
Partner - Creator III

Set dimension background colour based on expression value


Hello All.

I have an application in which I what to change the background colour for all dimensions based on the value of an expression.

The background colour is being set correctly, however, the editor is flagging the expression name as a 'Bad field name' in the dimension's background setting.

Is this an issue with the editor?

I have attached an application demonstrating the issue.  I am using QV11 SR2.

Thanks,

John.

1 Solution

Accepted Solutions
Nicole-Smith

If you've tested it on both the server and in desktop, and it seems to be working, I would go with it.  There are other times where expressions show as invalid (such as when using -= in set analysis) when they are in fact perfectly correct.

View solution in original post

6 Replies
Nicole-Smith

It's because you're referencing the expression by name.  If you change it to

=if(Sum(Sales) = 0,yellow(),white())

it won't show it as an error anymore.

maxgro
MVP
MVP

or

=if(Column(1) = 0,yellow(),white())

Not applicable

Hi

Try Like this

dimensions--->Background colour

if(sum(Sales)<=0,Yellow(),White())

john_duffy
Partner - Creator III
Partner - Creator III
Author

Thanks for the quick response Nicole, Massimo and Nirmal.

I do realize that I can enter the full expression or the column number.  The expression is much more complicate than in the sample I attached.

My thinking is that if I can use the expression label, which seems to work, then no change will be required to the background colour setting if the expression changes or if another coloumn is added to the chart.

I would like confirmation that using the expression label is valid and the 'Bad field name' message is a bug with the editor.

Thanks,

John.

Nicole-Smith

If you've tested it on both the server and in desktop, and it seems to be working, I would go with it.  There are other times where expressions show as invalid (such as when using -= in set analysis) when they are in fact perfectly correct.

maxgro
MVP
MVP

It works, on desktop and on server too (I tried Ajax)

I agree with you, John