Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I'm new in Qlik view. I'm facing problem to change color in bar chart. For your better understanding please see below screenshot. In my below chart A1-3, A4-4, A8-10, A11-15, A16-21, A30+ bar will be Green color and L1-3, L4-7 bar will be RED color. How can i solve this problem. please help me..
Regards,
Masba
Hi,
You are using Calculation dimension, so that the expression is not working. To do this in a better way try to do the calculation in script like below
Data:
LOAD
*,
If (PO_Ex_Factory_Date-PO_DATE<=-30,Dual('A30+',7),
If (PO_Ex_Factory_Date-PO_DATE<=-22,Dual('A22-30',6),
If (PO_Ex_Factory_Date-PO_DATE<=-16,Dual('A16-21',5),
If (PO_Ex_Factory_Date-PO_DATE<=-11,Dual('A11-15',4),
If (PO_Ex_Factory_Date-PO_DATE<=-8,Dual('A8-10',3),
If (PO_Ex_Factory_Date-PO_DATE<=-4,Dual('A4-7',2),
If (PO_Ex_Factory_Date-PO_DATE<=-1,Dual('A1-3',1),
if(PO_Ex_Factory_Date-PO_DATE=0, Dual('Ontime',8),
If (PO_Ex_Factory_Date-PO_DATE <=3, Dual('L1-3',9),
If (PO_Ex_Factory_Date-PO_DATE<=7, Dual('L4-7',10),
If (PO_Ex_Factory_Date-PO_DATE<=10, Dual('L8-10',11),
If(PO_Ex_Factory_Date-PO_DATE<=15, Dual('L11-15,12)',
If (PO_Ex_Factory_Date-PO_DATE<=21, Dual('L16-21',13),
If (PO_Ex_Factory_Date-PO_DATE<=30, Dual('L22-30',14),
If (PO_Ex_Factory_Date-PO_DATE>=30, Dual('L30+',15))))))))))))))))) AS Group
FROM DataSource;
Then in try like this
Chart :
Dimension : Group
Expression : sum(PO_INVOICED_QTY)
Background Expression = If(Match(DimensionName, 'A1-3', 'A4-4', 'A8-10', 'A11-15', 'A16-21', 'A30+'), RGB(0, 255, 0),
If(Match(DimensionName, 'L1-3', 'L4-7'), RGB(255, 0, 0)))
Regards,
jagan.
Hi Masba,
Please check:
Re: coloured bar chart based on value
https://community.qlik.com/message/448122#448122
Thanks,
AS
Hi,
Try like this
Chart Properties -> Expressions-> Click on + symbol of the expression -> Background Color -> Enter below expression
=If(Match(DimensionName, 'A1-3', 'A4-4', 'A8-10', 'A11-15', 'A16-21', 'A30+'), RGB(0, 255, 0),
If(Match(DimensionName, 'L1-3', 'L4-7'), RGB(255, 0, 0)))
Note: DimensionName with your actual field name
Hope this helps you.
Regards,
jagan.
Hi,
you can find my scenario's solution which may help you.
Hi,
Where is the bar chart in the attached file? There is only a pivot table, if you want to apply for Pivot table the background is applied to Cells.
I used this expression
=If(ARTICLE = '92114A60', RGB(0, 255, 0)) and it is changing the Background of the cell with ARTICLE 92114A60 to green color.
Regards,
Jagan.
Dear Jagan,
I'm extremly sorry.. I have attached wrong file.. please find correct file..
Masba
Hi,
You are using Calculation dimension, so that the expression is not working. To do this in a better way try to do the calculation in script like below
Data:
LOAD
*,
If (PO_Ex_Factory_Date-PO_DATE<=-30,Dual('A30+',7),
If (PO_Ex_Factory_Date-PO_DATE<=-22,Dual('A22-30',6),
If (PO_Ex_Factory_Date-PO_DATE<=-16,Dual('A16-21',5),
If (PO_Ex_Factory_Date-PO_DATE<=-11,Dual('A11-15',4),
If (PO_Ex_Factory_Date-PO_DATE<=-8,Dual('A8-10',3),
If (PO_Ex_Factory_Date-PO_DATE<=-4,Dual('A4-7',2),
If (PO_Ex_Factory_Date-PO_DATE<=-1,Dual('A1-3',1),
if(PO_Ex_Factory_Date-PO_DATE=0, Dual('Ontime',8),
If (PO_Ex_Factory_Date-PO_DATE <=3, Dual('L1-3',9),
If (PO_Ex_Factory_Date-PO_DATE<=7, Dual('L4-7',10),
If (PO_Ex_Factory_Date-PO_DATE<=10, Dual('L8-10',11),
If(PO_Ex_Factory_Date-PO_DATE<=15, Dual('L11-15,12)',
If (PO_Ex_Factory_Date-PO_DATE<=21, Dual('L16-21',13),
If (PO_Ex_Factory_Date-PO_DATE<=30, Dual('L22-30',14),
If (PO_Ex_Factory_Date-PO_DATE>=30, Dual('L30+',15))))))))))))))))) AS Group
FROM DataSource;
Then in try like this
Chart :
Dimension : Group
Expression : sum(PO_INVOICED_QTY)
Background Expression = If(Match(DimensionName, 'A1-3', 'A4-4', 'A8-10', 'A11-15', 'A16-21', 'A30+'), RGB(0, 255, 0),
If(Match(DimensionName, 'L1-3', 'L4-7'), RGB(255, 0, 0)))
Regards,
jagan.
@hi Masba try like below
If(Dimension=Wildmatch(Dimension,'A*'),RGB(0, 255, 0),If(Dimension=Wildmatch(Dimension,'L*'),RGB(255, 0, 0)))
or you can simply use
if(right(Dimension,1)='A',,RGB(0, 255, 0),If(right(Dimension,1)='L',RGB(255, 0, 0)))
My suggestion is create in script instead of that calculated dimension
then use can that in dimension
If(Dimension=Wildmatch(Dimension,'A*'),RGB(0, 255, 0),If(Dimension=Wildmatch(Dimension,'L*'),RGB(255, 0, 0)))
Dear sunil,
Thanks for good advise.. I want to take this formula " if(right(Dimension,1)='A',,RGB(0, 255, 0),If(right(Dimension,1)='L',RGB(255, 0, 0)))" . But my Dimension is calculative. how can i implement this.. Below formula I used in my calculative dimension.
=If (PO_Ex_Factory_Date-PO_DATE<=-30,Dual('A30+',7),
If (PO_Ex_Factory_Date-PO_DATE<=-22,Dual('A22-30',6),
If (PO_Ex_Factory_Date-PO_DATE<=-16,Dual('A16-21',5),
If (PO_Ex_Factory_Date-PO_DATE<=-11,Dual('A11-15',4),
If (PO_Ex_Factory_Date-PO_DATE<=-8,Dual('A8-10',3),
If (PO_Ex_Factory_Date-PO_DATE<=-4,Dual('A4-7',2),
If (PO_Ex_Factory_Date-PO_DATE<=-1,Dual('A1-3',1),
if(PO_Ex_Factory_Date-PO_DATE=0, Dual('Ontime',8),
If (PO_Ex_Factory_Date-PO_DATE <=3, Dual('L1-3',9),
If (PO_Ex_Factory_Date-PO_DATE<=7, Dual('L4-7',10),
If (PO_Ex_Factory_Date-PO_DATE<=10, Dual('L8-10',11),
If(PO_Ex_Factory_Date-PO_DATE<=15, Dual('L11-15,12)',
If (PO_Ex_Factory_Date-PO_DATE<=21, Dual('L16-21',13),
If (PO_Ex_Factory_Date-PO_DATE<=30, Dual('L22-30',14),
If (PO_Ex_Factory_Date-PO_DATE>=30, Dual('L30+',15)))))))))))))))))
Regards,
Masba