Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

camjvine18
Contributor

Chart conditional colour formatting

I am attempting to have a default bar chart coloured.

When a User initially opens the Dashboard, the SLA Entire Risk Engine batch details will appear and where minutes are negative, bars should be red and where minutes are positive bars should be green (will change colour for colour blind people another time).

The code works fine if I don't use a default selection but when I introduce a default selection the positive minutes red instead of green.

If((isnull(Milestone) AND Min({<System={'Source'},Milestone={'Entire Risk Engine batch'},Status={'Breach'}>} Minutes))<0,

    rgb(255,110,110),

If((isnull(Milestone) AND Max({<System={'Source'},Milestone={'Entire Risk Engine batch'},Status={'Breach'}>} Minutes))>0,

    Green(),

If(Min({<System={'Source'},Status={'Breach'}>} Minutes)<0,   

    rgb(255,110,110),

    Green(),

    )))

Capture.PNG

1 Solution

Accepted Solutions
Ralf_Heukäufer
Contributor III

Re: Chart conditional colour formatting

Here is your original app with my changes in the one bar chart visualisation:

25 Replies
Ralf_Heukäufer
Contributor III

Re: Chart conditional colour formatting

Hello Cameron you can use

if(If(isnull(Milestone),

    Min({<System={'Source'},Milestone={'Entire Risk Engine batch'},isExclusion={0}>} Minutes),

    Min({<System={'Source'},isExclusion={0}>} Minutes))<0,rgb(255,110,110),green())

instead of your declaration.

Re: Chart conditional colour formatting

I have not dug deeper into your qvf file, but is there a reason your use Min < 0 and Max > 0 check? Why not both mins or both maxs?

Capture.PNG

camjvine18
Contributor

Re: Chart conditional colour formatting

That fixes the default selection but as soon as another Milestone is selected than the problem persists.

camjvine18
Contributor

Re: Chart conditional colour formatting

Cos all other variations have not worked and when I change to both Min then I still have the problem.

camjvine18
Contributor

Re: Chart conditional colour formatting

Apologies, I was wrong in my statement, this works.

camjvine18
Contributor

Re: Chart conditional colour formatting

and spoke to soon again as for some reason I have a problem on the chart next to it now

camjvine18
Contributor

Re: Chart conditional colour formatting

I have not fixed it and it works on both charts.

camjvine18
Contributor

Re: Chart conditional colour formatting

While I have fixed one issue I still have another issue on this chart. I thought this expression would only include dates where Is exclusion = 0 but it still shows dates even though I have this exclusion. If I select the isExclusion filter the chart does not change either. Capture.PNG

If(isnull(Milestone),

Min({<System={'Source'},Milestone={'Entire Risk Engine batch'},isExclusion={0}>} Minutes),

Min({<System={'Source'},isExclusion={0}>} Minutes))

shraddha_g
Honored Contributor III

Re: Chart conditional colour formatting

Try unchecking "Show zero values"

Community Browser