Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

aggr()


my data is:

load

Customer, Value ,RowNo() as g inline [
Customer, Value
infy, 20
tcs, 30
infy, 10
tcs, 15
google, 40
google, 400
accenture,353
ibm,3625
accenture,245
]
;

when i use

Aggr

((sum(Value)/count(g)),Customer) ->

i get each customer and their corresponding average

but when i  use

Aggr((sum(Value)/g),Customer) ->only ibm like this

ibm453.125

Can any1 explain y this happens?

4 Replies
morganaaron
Specialist
Specialist

How are you trying to show the output of the Aggr statement? And what output are you trying to achieve?

I can only assume it's showing IBM as it's the only non-repeated name, and your Aggr statement (unless it's over the dimension g) then can't return a unique value as it's got multiple values for g. Why are you dividing by the row number? Do you mean the second equation to be Count(g) as the first is?

Not applicable
Author

temp.png

Not applicable
Author

@Aaron Morgan

s aaron just i want 2 find out wrkng of aggr func() .

as u can c i used table box fr both charts

i wanted 2 know when i use sum(value)/count(g) -> it is givng average value of all customers and when i use sum(value)/g -> it is giving average value of only the ibm.....how it can behave like tat

marcus_sommer

Aggr((sum(Value)/g),Customer)

The reason of this behavior is the missing from an aggegation from field - have a look here why you should always use aggreagtions:

http://community.qlik.com/blogs/qlikviewdesignblog/2014/06/16/use-the-aggregation-functions

- Marcus