12 Replies Latest reply: Jul 8, 2016 12:55 PM by Sunny Talwar

# Chart Average line value -> use it in other chart

this is shown in first chart: together with internal average line.

and i need to know this average value to use it in a second chart:

e.g. this second chart uses other values but those values need to be coloured if they are higher or lower than the average value of the first diagram ?

My question is: can we get this value within module scripts ?

hi,

how can I use a chart average (trend line) value in another diagramme ?

is there any possibility to read this average value (trend line) within a macro ? like Chart.properties and then the average value ?

I could not find any solution.

• ###### Re: Chart Average line value -> use it in other chart

Would you be able to share an example of what you are trying to do? May be it is doable without a macro? Not really sure until we see more details

• ###### Re: Chart Average line value -> use it in other chart

Is this what you are looking for?

Where the avg line is created using this expression:

Avg(TOTAL Aggr(Sum([Messwert 1]), Datum))

and background color using this:

If(Column(1) > Column(2), LightGreen(), LightRed())

Where Column(1) is your expression for the bar [Messwert 2] and Column(2) is the Avg expression from above (Avg(TOTAL Aggr(Sum([Messwert 1]), Datum)))

• ###### Re: Chart Average line value -> use it in other chart

Am not sure if I totally understand the requirements.

Can you capture the average in an expression/variable? and use that as a "reference line" under Presentation tab of the chart properties?

• ###### Re: Chart Average line value -> use it in other chart

however I have still one question about conditional coloring of the chart rows:

I know tha in diemnsion or expression I can use background coloring in an if expression.

BUT: I have 5 rows in a chart.

each row-value has to be compared to the value of a related variable.

so: field1 (of row1) compared to variable1, field2 (of row2) compared to variable2 ....

how is this possible:

with the expression RowNo and building nested if clauses ?

or which are the options,

thanks again

• ###### Re: Chart Average line value -> use it in other chart

5 rows in a chart? I am not entirely sure I understand your question. Can you elaborate a little?

• ###### Re: Chart Average line value -> use it in other chart

sorry 5 rows in a table box, not chart.

• ###### Re: Chart Average line value -> use it in other chart

Can you provided an updated sample with the expected output?

• ###### Re: Chart Average line value -> use it in other chart

i added a sample for this problem

• ###### Re: Chart Average line value -> use it in other chart

sample: test_bgcolor.qvw

problem description:

i have 5 variables which contain limit values for each row of the pivot table (sorry: it is a pivot table):

so this is okay.

but it is checking each row of the value column and comparing to variable1.

But I need to compare:

value of row1 with variable1

value of row2 with variable2

value of row3 with variable3

value of row4 with variable4

value of row5 with variable5

is there any solution possible for this ?

I read RowNo() for identifying the row;

is sitch case possible instead o nested if ?

or better solution ?