Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Conditional Formatting on Combo Charts

Hi,

I currently have a combo chart that measures the sales against the target for each year (with year going along the x axis, volume along the y axis, and both sales and targets have individual bars). When I go to change the colour, I have three options: Single Colored, Multicolored and By Expression. What I want, is the Multicolored option, but with more control over the colours of the bars.

I tried the following expression:

IF ( Type = SUM (Target), RGB (255, 0, 0),  RGB (0, 0, 255) )

However this tells me that 'Type' is a Bad Field Name, and so the formula doesn't work. Does anyone have any suggestions on how to write this particular bit of code?

Thanks.

EDIT: I've attached an example of the table that I've currently got. I basically need to be able to change the colour of the Target and Sales bars independently.

5 Replies

Re: Conditional Formatting on Combo Charts

Provide sample app to check what's wrong !

Re: Conditional Formatting on Combo Charts

Not applicable

Re: Conditional Formatting on Combo Charts

From reading that blog, I believe that the code should be something like:

IF( ValueList( 'Sales', 'Target' ) = 'Target', RGB(255,0,0), RGB(0,0,255))

But that still doesn't seem to be working... Am I misunderstanding what the blog is saying?

The data is formatted like:

Year | Store Name | Sales | Target

brunobertels
Valued Contributor

Re: Conditional Formatting on Combo Charts

Hi Thomas

the blog you read is dealling with synthetic dimension eg you have sales per month for several years and you want lines per years. to compare sales per month for those différent years. In that case it's working.

may be try this

IF ( SUM (Target)>=0, RGB (255, 0, 0),if(SUM (Sales)>=0 , RGB (0, 0, 255)))

bruno

Not applicable

Re: Conditional Formatting on Combo Charts

Hi Bruno, thanks for answering, however the problem with this expression is that the table is in the form:

Year     | Sales | Target

2015     | 1000  | 900

2014     | 1500  | 1000

2013     | 2000  | 1500

So when you write the code IF ( SUM (Target)>=0, RGB (255, 0, 0), IF(SUM (Sales)>=0 , RGB (0, 0, 255))) then each line will have a target greater than zero so it will always be red. In other words, your code doesn't distinguish between the Sales and the Target columns, so it will always colour both bars either Red or Blue and not one of each.