Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

How to Use Aggr Function for custom variable

Hi all,

I have created some custom variable (using variable overview)  and performed count/sum operation on it , for example

attenance_var = Count(if(a=10,class_attndance)) and using this into pivot table in a expression like $(attendance_var).

now When i am using the aggr function on it then all the rows becoming null or showing - symbol.

so wanted to know that how can I get the aggregate for a expression which is already performing some Count/Sum operation..

Please help , stuck in this from a long time.

Regards

Ravindra Mandre

6 Replies
nstefaniuk
Contributor III

How to Use Aggr Function for custom variable

Hi.


Can you post the aggr() code please?

The steps should be:

- create your straight table with the dimensions and the expressions (for example Dim1, Dim2 and Exp1)

- copy the expression to set in dimension (Exp1)

- create a calculated dimension with formula : aggr( Exp1, Dim1, Dim2)

- you should have in your straight table 2 columns with same value : 1 is the calculated dimension, the other is the expression.

Not applicable

How to Use Aggr Function for custom variable

Hi,

I have given the sample code in the description , am creating variable named attendance_var and using this into expression like

attenance_var = Count(if(schoolCode=10,class_attndance))

then using the above variable in expression like

aggr($(attendance_var))

This does not shows nothing and value comes as null or -.

Regards

Ravi

nstefaniuk
Contributor III

How to Use Aggr Function for custom variable

Try

aggr(Count(if(schoolCode=10,class_attndance)), Dim1, Dim2, ..., DimN)

Not applicable

How to Use Aggr Function for custom variable

Hi,

I have tryied it

aggr(Count(if(schoolCode=10,class_attendance)))

but it does not returns anything.

Also saw other posts but no luck.

Any other way to get variable's value and putting aggregate on it.

Regards

Ravi

MVP
MVP

How to Use Aggr Function for custom variable

Ravi,

The Aggr() function always takes two parameters. The first is the expression you want to aggregate, the second is the dimension you want to aggregate on. In your case above, the Count() part would be fine, but you need to add the dimension on waht you want to aggregate that Count().

Hope that makes sense.

Miguel

Not applicable

How to Use Aggr Function for custom variable

Thanks Miguel ,

Now expression is returning some value , I have to check and correct my expression.

Regards

Ravi

Community Browser