Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Problem with Avg function

Hello Everybody,

I have a problem with my following expression :

I'm trying to make a custom multiple list with the following expression :

if(ESMS.CODE_CATEGORIE=200,10 * ($(v_pct_plafond)/100), $(v_capacite_au_01/01/N) *  avg (COUT_MOYEN_NATIONAL.COUT_MOYEN) * ($(v_pct_plafond)/100)).

It doesn't work beacuse of the AVG function.

When i replace the AVG expression with a constant, it works perfectly, i can choose any value as I want to.

Can you please explain me why? Is there any solution to make it work with the avg function?

We previously faced the same problem with sum() function and it seems that "aggr()" was the solution.

But this time, it's a bit more complicated

1 Solution

Accepted Solutions
Employee
Employee

Re: Problem with Avg function

you may need to wrap the existing expression in an aggr()

Aggr(  <existing expression >   ,  <Dimension> )

If you are using it in a chart with multiple dimensions, list all dimensions.

if you get stuck see if you can attach a QVW sample

3 Replies
Employee
Employee

Re: Problem with Avg function

you may need to wrap the existing expression in an aggr()

Aggr(  <existing expression >   ,  <Dimension> )

If you are using it in a chart with multiple dimensions, list all dimensions.

if you get stuck see if you can attach a QVW sample

Not applicable

Re: Problem with Avg function

Ok, I will try different uses of the Aggr() function, thank you.

Not applicable

Re: Problem with Avg function

it is indeed the right solution, thanks a lot .

Community Browser