Qlik Community

Qlik Sense App Development

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

Announcements
Uploads getting stuck in the virus scanner. We are investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

How to change histogram bar color dynamically with expression

Hi,

I've been trying to write an expression that changes the histogram bar to the color red whenever there is 3 months of consistent growth.  I'm new at Qlik Sense so please have patience with me.

Is it possible that this can happen dynamically when the histogram changes when the data filters are changed?  

Below in the capture of what I'm trying to achieve.  Any help would be greatly appreciated.

Thanks

Rich 

Capture.JPG

Labels (3)
3 Replies
Highlighted

Hi Rich, maybe using a straighforward query using Above and Below based on expression.
In attachement check color expression to see an example.

 

Well it doesn't allow me to upload qvf

 

Script was:

LOAD * Inline [
dim, value
1,5
2,7
3,1
4,3
5,5
6,7
7,5
8,1
9,5
10,7
11,3
];

 

Expression:

Sum(value)

Expression Label: Value

 

And color expression:

If(([Value]>Above([Value]) and [Value]>Above([Value], 2))
or ([Value]>Above([Value]) and [Value]<Below([Value]))
or ([Value]<Below([Value]) and [Value]<Below([Value], 2))
, LightRed(), blue())

Highlighted
Contributor II
Contributor II

I tried your solution and it worked well, but the only thing I noticed was it doesn't account for months with null values.  I understand that it looks at the rows above and below and if there is no input for that month then it doesn't show up in the table. 

Is there a way to account for this?

 Capture1.JPG

 

Highlighted

Hello, creating a master calendar can help on having all months in x axis, this way null value can turn into 0 if expression is a sum().

Also the expression neded some adjustments:
If(([Value]>Above([Value]) and [Value]>Above([Value], 2) and Above([Value])>Above([Value], 2))
or ([Value]>Above([Value]) and [Value]<Below([Value]))
or ([Value]<Below([Value]) and [Value]<Below([Value], 2) and Below([Value])<Below([Value], 2))
, LightRed(), blue())