Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Colors for bars based on Target

Hi All,

I am having a bar chart in qliksense application which needs to show based on target value.

If bar is higher than target then it will be green else red.

This bar chart will have the two set of expression like previous month and previous year.

So I need to show the Bars based on Target value either in Red or Green based on Target on both 'Previous Month' and 'Previous Year' view

The below expression used in "Measure"

Exp 1:

if(v_set_reset=1,sum({<MetricName= {'M1'},Period = {'$(=$(v_previous_month))'}>}vlaue),

(sum({<Level2Name = {'Perfect Index'},Year = {'$(=$(v_previous_year))'}>}Level2vlaue))/12)

The Target expression used in Colors

Exp 2:

(only({<metric_id = {'51'},loc= {'1'}>}boundary),RGB(70,198,70),RGB(249,63,23))

so if Exp 1 > Exp 2 RGB(70,198,70),RGB(249,63,23)

1 Reply
kvanandan1
Creator
Creator

Hi ,

In the color expression, please try similar to below expression

=if($(vMeasure)=1, if(Sum(Pmonth)>Sum(Target),green(),red()), if(Sum(Pyear)>Sum(Target),green(),red()))