Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Creator III
Creator III

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
Author

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
Creator III
Creator III

Try

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

Not applicable
Author

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

Miguel_Angel_Baeyens

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
Author

Thanks Miguel ,

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

Regards

Ravi