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

Grouped Bar Chart different colors for each measure

Hello All,

I have a scenario in Qlik Bar Chart, which grouped.I have 1 dimension ( date field) and 2 measure ( sales and pre-sales). 

I have reference line which is average of sale for the entire date range.

I have implement color of bars based on expression.

If the bar is above Average Sales the bar color is red and if it is below Average Sales bar color is green.

Problem is I also want to have different colors for the Sales Bar and Pre-Sales Bar which are grouped in same date.

Is there a way to achieve this ?

Image21.PNG

Image22.PNG

Image23.PNG

Image24.PNG

    

2 Replies
forte
Partner - Creator
Partner - Creator

Hi @baarathi 

You can't do that using different measures. Instead of that, yo can split between measures using a calculated Dimension with Valuelist (in example, there are other ways, as logic island in script). Doing so, yo just use a single measure expression , and much more important, you can differenciate between one column and other in colour expression. It will looks something like that

if(ValueList('Sales','Presales') = 'Sales' ,if(Sum(Sales) > avg(TOTAL Sales), Green(), Red()),
if(ValueList('Sales','Presales') = 'Presales',if(Sum(PreSales) > avg(TOTAL Sales), Green(), Red()),
))

Also notice a secons change. If you want to refer to general average for sales, you need to use TOTAL por your average expression ( avg(TOTAL Sales) ). Doing so, you obtein same value (and correct) for all dimensions values.

Attached Example solved.

Hope it helps

Regards

 

baarathi
Creator III
Creator III
Author

@forte  Thanks a lot, that saved my day.