Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Conditional Coloring

Hi guys,

I've been trying to do some searching for conditional expressions, but I haven't had any luck so far.

Right now I have two KPIs. One that shows Revenue from 2014 and one from 2015.

I did set analysis to filter the revenue by the year:

2014 Revenue Expression: Sum({$<Year={"FY14"}>}"Revenue")

2015 Revenue Expression: Sum({$<Year={"FY15"}>}"Revenue")


Now, I would like the 2015 Revenue to be a certain color depending on if it's higher or lower than 2014 Revenue (example: red if lower, green if higher).


I checked conditional coloring, but I'm a little confused as to how the expression should be formatted (most likely an if expression?).


Any help would be greatly appreciated. Thanks!

1 Solution

Accepted Solutions
phaneendra_kunc
Valued Contributor III

Re: Conditional Coloring

glyphs are not working. It always picks one and doesnt show conditionally.

May be can use like the one in attached.

26 Replies
stigchel
Honored Contributor

Re: Conditional Coloring

if ( Sum({$<Year={"FY15"}>}"Revenue")- Sum({$<Year={"FY14"}>}"Revenue")<0,red(),green())


You can set these in the the background/text color options for the expression by clicking on the +sign in front of the expression.

Not applicable

Re: Conditional Coloring

Where exactly do I put the expression you wrote?

In the min/max ranges for conditional coloring? That doesn't seem to work.

Thanks for your quick response.

stigchel
Honored Contributor

Re: Conditional Coloring

So where you use these expressions?? In a chart bar/table/pivot/text box??

I was assuming in a chart, in the expression tab click on the plus sign

BgColorDate.png

stigchel
Honored Contributor

Re: Conditional Coloring

Oh sorry, I see now this is for Sense, not sure this applies. Sorry

Not applicable

Re: Conditional Coloring

Yes, I'm using Qlik Sense. Thanks for your help though!

If anyone else knows how to correctly apply conditional coloring in this case, I would greatly appreciate it!

phaneendra_kunc
Valued Contributor III

Re: Conditional Coloring

Which object are you using?

KPI object, Table, Bar, Line?

Not applicable

Re: Conditional Coloring

I'm using KPI!

phaneendra_kunc
Valued Contributor III

Re: Conditional Coloring

Assuming you have tow KPI objects one with 2014 and one with 2015.

see attached for the reference. Choose "A2Z Solutions" as customer in the filter.

At a glance what i did is...

1. enable conditional colors for the metric you need to color.

2. add a limit

3. in Min box input 2014 expression

4. in Max box input 2015 expression

5. for lower bound pick green and upper bound pick red.

Not applicable

Re: Conditional Coloring

I understand the way you organized it, but what if 2015 is lower than 2014? Then it wouldn't work as a max. Wouldn't we need an if statement or the like?