Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average of a field

Hello, I am fairly new to QlikView and I wouldn't be posting a question if I could find an answer. I need to add a column to a table that has values for each row equal to the average of the values of the previous column. Example of what I need to accomplish(underlined):

Name Value Mean

A        2        3

B        3        3

C        4        3

Thank you for the help in advance!

7 Replies
sunny_talwar

May be this:

Table:

LOAD Name,

          Value

From Source;

Join (Table)

LOAD Avg(Value) as Mea

Resident Table;

luizmendes118
Contributor III
Contributor III

Try this in 'Mean' Expression

AVG(Total(Value))

Anonymous
Not applicable
Author

Sunny, Avg() function does not required any grouping?

like this?

LOAD Avg(Value) as Mea

Resident Table

group by Dimension;


sunny_talwar

I have no fields listed in my load, so in this case Group By is not required. If I did have a non-aggregating field, then Yes you are right, I would need a Group By statement.

Not applicable
Author

You are right Sunny and even though the OP has asked for this I would have to ask why he would want change at script level. If this is suppose to dynamically change based on filters in the model then Luiz approach is correct, otherwise mean-of-mean (average of an average) would take place

Anonymous
Not applicable
Author

Ohh..okay, did not noticed that you are taking single field only in resident

Not applicable
Author

I only need this at script level, it does not get to the model, for I only need to export data to a qvd, not display it. Thank you though for your response.