10 Replies Latest reply: Jun 6, 2017 4:58 AM by Taj Mohamed

# Colour by expression on single colours

I have a line chart with two expressions, is there a way I can colour each expression with two different single colours?

• ###### Re: Colour by expression on single colours

on the expression background color you can try like

=if(sum(Sales)>=5000,Green(),if(sum(Sales)<=4999,Red()))

• ###### Re: Colour by expression on single colours

Hi Taj, that's not what i want to do. I have two expression:

1. Sum([Home Yellow]) + Sum([Away Yellow])

2. Sum([Home Red])+Sum([Away Red])

I want to colour the first expression as yellow and second expression as red. Now i've tried

if((Sum([Home Yellow]) + Sum([Away Yellow])), rgb (255,0,0), if((Sum([Home Red])+Sum([Away Red])),rgb (0,255,0)))

I've also tried

if((Sum([Home Yellow]) + Sum([Away Yellow]))=(Sum([Home Yellow]) + Sum([Away Yellow])),yellow(),if((Sum([Home Red])+Sum([Away Red]))<=(Sum([Home Red])+Sum([Away Red])),Red()))

They both don't work.

Regards,

Vic

• ###### Re: Colour by expression on single colours

on the properties>colors tab, you can change colour 1 and 2 and also you have the option to define rgb values

• ###### Re: Colour by expression on single colours

This is on Qliksense btw

• ###### Re: Colour by expression on single colours

Create a dimension using valuelist(),

Valuelist('Home Yellow + Away Yellow','Home Red + Away Red')

then create 1 expression:

1. if(rowno()=1,

Sum([Home Yellow]) + Sum([Away Yellow]),

Sum([Home Red])+Sum([Away Red])

)

then under "Aspect->Colors" use "color by expression" and write:

if(rowno()=1,rgb (255,0,0),rgb (0,255,0))

• ###### Re: Colour by expression on single colours

Hi, it's a line chart and the only dimension is 'Months'. How will creating a valuelist dimension solve this?

• ###### Re: Colour by expression on single colours

On expression background set:

rgb (255,0,0) //(for Sum([Home Yellow]) + Sum([Away Yellow]) expression)

rgb (0,255,0) //(for Sum([Home Red])+Sum([Away Red]) expression )

• ###### Re: Colour by expression on single colours

This Qlikview, i'm talking about the ability to do this on Qliksense

• ###### Re: Colour by expression on single colours

Thanks Taj, this is the answer.

You have to be using Qlik Sense 3.2 (if not, please upgrade)to be able to affect color to master measures:

Below, I'll be creating 2 master measures: sum("car sales") and sum("commercial vehicle sales"):