Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need expert advice : Conditional Bar Chart Colour Expression

Hi All,

I posted a while back for some help on how to format an individual bar to a certain colour based on a conditional expression. Unfortunately I was unable to get help and still have this problem.

My expression in the 'background colour' for my expression is the following

if(

          (sum({<CalendarMonthAndYear={'>=$(v12MonthMin)<=$(v12MonthMax)'}>}Cost)+

          sum({<CalendarMonthAndYear={'>=$(v12MonthMin)<=$(v12MonthMax)'}>}HistoricCostTrendCost))=

          MaxString(

          RangeMax(

          Max(TOTAL aggr(sum({$<CalendarMonthAndYear={'>=$(v12MonthMin)<=$(v12MonthMax)'},CallType={'o'}>}Cost),CalendarMonthAndYear)),

          Max(TOTAL aggr(sum({$<CalendarMonthAndYear={'>=$(v12MonthMin)<=$(v12MonthMax)'}>}HistoricCostTrendCost),CalendarMonthAndYear)))),red(),green())

This expression

sum({<CalendarMonthAndYear={'>=$(v12MonthMin)<=$(v12MonthMax)'}>}Cost)+

sum({<CalendarMonthAndYear={'>=$(v12MonthMin)<=$(v12MonthMax)'}>}HistoricCostTrendCost)

is the actual expression that sums up the cost for each calendarmonthandyear (i have this as the dimension in the bar chart). So my conditional expression says when the sum of that value equals the max aggregated value over the whole term, then colour that. My output is always green for every bar.

I think its cause I need to aggregate again to ensure that it is still not doing it by calendarmonthandyear, but not sure how I would get this to work. Individually both expressions work great. The maxstring gives me in a text box the value I am looking for, so why can't this in the conditional give me the same result. my thinking says thats its because in my chart I have used calendarmonthandyear as the dimension. Anyway, if anyone knows what I am doing wrong, please help me out

Thanks,

Byron

3 Replies
Not applicable
Author

bump! comeon guys, there must be someone that knows how to do this

Cheers,

Byron

sushil353
Master II
Master II

is it possible to upload the sample application.

sunilkumarqv
Specialist II
Specialist II

Can you make it simple Question?