6 Replies Latest reply: Dec 13, 2012 6:00 AM by Gutemberg Fayad

# How to change graph colors based on calculated dimension values

I have a dimension that

aggr

(sum (Qtde) /
(
sum ({\$<Ano_Mes = {\$(=Max(Ano)&num(Max(Mes),'00') ) } >}  [Expectativa Vendas])
*
num(MaxString([Mês Filtro]))), PartNumber)

And  depends on the results I need   diferent collors in the pizza graphs.

• ###### Re: How to change graph colors based on calculated dimension values

HI

Can you explain more details? If possible, can you provide a sample file?

• ###### Re: How to change graph colors based on calculated dimension values

Sorry, unfortunately i have sensitive data and i cannot create a sample, however below i put more details

Dimension :

= if(

aggr(sum (Qtde) /
(
sum ({\$<Ano_Mes = {\$(=Max(Ano)&num(Max(Mes),'00') )} >}

[Expectativa Vendas])
*  num(MaxString([Mês Filtro]))), PartNumber)

<=Var_Cor_Penetracao_Amarelo,

dual('Crítico',1)  ,

if(

aggr(sum (Qtde) /
(
sum ({\$<Ano_Mes = {\$(=Max(Ano)&num(Max(Mes),'00') )} >}

[Expectativa Vendas])
*  num(MaxString([Mês Filtro]))), PartNumber)

<=Var_Cor_Penetracao_Laranja ,

dual('Regular',2),

if(
aggr(sum (Qtde) /
(
sum ({\$<Ano_Mes = {\$(=Max(Ano)&num(Max(Mes),'00') )} >}

[Expectativa Vendas])
*  num(MaxString([Mês Filtro]))), PartNumber)

<=Var_Cor_Penetracao_Marinho,

dual('Bom',3),
if(
aggr(sum (Qtde) /
(
sum ({\$<Ano_Mes = {\$(=Max(Ano)&num(Max(Mes),'00') )} >}

[Expectativa Vendas])
*  num(MaxString([Mês Filtro]))), PartNumber)

<=Var_Cor_Penetracao_Verde,

dual('Muito Bom',4),

if(aggr(sum (Qtde) /
(
sum ({\$<Ano_Mes = {\$(=Max(Ano)&num(Max(Mes),'00') )} >}

[Expectativa Vendas])
*  num(MaxString([Mês Filtro]))), PartNumber)

>Var_Cor_Penetracao_Verde,

dual('Excelente',5)

)
)
)
)
)

Expression : Count (DISTINCT PartNumber)

I've already tried put the same expession ,  only chaging dual function by the collor (red(), blue etc),  in the background color propertie from this dimension and also in the background collor from the expression.

• ###### Re: How to change graph colors based on calculated dimension values

HI

In background color, use like this

if(

aggr(sum (Qtde) / (sum ({\$<Ano_Mes = {\$(=Max(Ano)&num(Max(Mes),'00') )} >}[Expectativa Vendas]) *  num(MaxString([Mês Filtro]))), PartNumber) <= Var_Cor_Penetracao_Laranja , red(), blue())

And test, it will show the red color for first dimension and remaining the blue color?

May be any bracket miss while changing the dual() to color function.

• ###### Re: How to change graph colors based on calculated dimension values

Hi,

I tried your instruction on both background collor properties (dimension and expression) and also in the collor set.

Didn't work!

It could be solved getting dimension values . for example : if (Dimesion.label = 'x', red(), blue() ) however QV does not allow make this kind of reference to a calculated dimension. It only works when you are referencing dimensions defined with table fields.

• ###### Re: How to change graph colors based on calculated dimension values

Click on the + in front of the dimension and select Background Color. Then click on the Edit button. Now you can add an expression that calculates the color.

If( some_epxr = 12, red(), if some_epxr = 18.5, green(), blue() ))

Replace some_expr with your expression for the calculated dimension and change the comparison values as needed.

If you have a lot of values, you might want to use a pick-match combination instead of a nested if.

• ###### Re: How to change graph colors based on calculated dimension values

I've already tried it, but haven't work.