Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rennesia
Contributor III
Contributor III

Table with calculated row

I have a table with 2 columns: Id and Temp. In a 3rd column I need the average value of the column Temp for equal Id's. Attached you find the wished table.
How can I generate this 3rd column in the script after loading the first 2 columns?
Thanks!

Labels (1)
1 Solution

Accepted Solutions
Saravanan_Desingh

Script solution.

tab1:
LOAD * INLINE [
    Id, Temp
    1, 5
    1, 4
    1, 3
    2, 7
    2, 7
    2, 9
    2, 9
    3, 6
];

Left Join(tab1)
LOAD Id, Avg(Temp) As AvgTemp
Resident tab1
Group By Id;

View solution in original post

4 Replies
rubenmarin

Hi, you can try with:

Avg(TOTAL <Id> Temp)

Brett_Bleess
Former Employee
Former Employee

If Ruben's post got you what you needed, we would appreciate it if you could return to the thread and close it out by using the Accept as Solution button on his post.  This gives him credit for the help and lets other members know that worked.

The only other thing I have is the following Design Blog post that may be of some further help:

https://community.qlik.com/t5/Qlik-Design-Blog/Average-Which-average/ba-p/1466654

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Saravanan_Desingh

Script solution.

tab1:
LOAD * INLINE [
    Id, Temp
    1, 5
    1, 4
    1, 3
    2, 7
    2, 7
    2, 9
    2, 9
    3, 6
];

Left Join(tab1)
LOAD Id, Avg(Temp) As AvgTemp
Resident tab1
Group By Id;
Saravanan_Desingh

commQV05.PNG