# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

## Gauge Chart - AVG

Hi,

I have a excel file where you finde date and value. Normaly from 0 until 9.

I set the gauge chart values for green and red that green starts at 8.4.

Now i would like to get the average from the values. If i click just one it shows the correct value in the chart but if i mark 2 or more values then he just shows me the lowest value.

Gauge Chart: I have Dimensions: Value and at Expressions: Avg(Value)

Another question is if i have 3x 8.0 and 1x 9.0 is it like (8+8+8+9)/4 or is it (8+9)/2 ?

Tags (3)
1 Solution

Accepted Solutions
Valued Contributor

## Re: Gauge Chart - AVG

When you click 8 and 9, your chart might appear to show the lowest value (8) instead of the Avg (8.5) because of rounding. Check what is on the Number properties, or try adding your expression to a text object so you can check the output.

Your gauge chart should not have any dimensions and should have one expression.

As for how avg() works:

1. Avg() will add the values and divide by the number of values, so (8+8+8+9)/4.

2. If you want (8+9)/2 you would have to do a sum(distinct Value)/count(distinct Value)

Jonathan

2 Replies
Valued Contributor

## Re: Gauge Chart - AVG

When you click 8 and 9, your chart might appear to show the lowest value (8) instead of the Avg (8.5) because of rounding. Check what is on the Number properties, or try adding your expression to a text object so you can check the output.

Your gauge chart should not have any dimensions and should have one expression.

As for how avg() works:

1. Avg() will add the values and divide by the number of values, so (8+8+8+9)/4.

2. If you want (8+9)/2 you would have to do a sum(distinct Value)/count(distinct Value)

Jonathan

Not applicable

## Re: Gauge Chart - AVG

After deleting the dimensions it workes.

Thanks for the information

Thanks also for the sample with the avg.