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: 
Not applicable

Calculation in script

Hi all,

Its simple but I am missing a hook.Not sure what wrong I am doing.Please khelp me here.


I have table with ID,Cost and People

ID   Cost      People

1    10000      20

2    20000      10

3    30000      10

Here I have to calculate Cost per person

Tabl1:

Load

ID,

Cost,

People

from Table name;

Load ,

ID,

Sum(Cost)/sum(People) as Cost/Person

Resident Tabl1

GROUP BY ID;

I am not getting the exact output for Cost/Person.Not sure what is wrong here.Can somebody point at the mistake I am doing ?

Thanks much

2 Replies
sunny_talwar

What are you getting and what do you expect to get?

maxgro
MVP
MVP

it seems ok to me

1.png

Tabl1:

load * inline [

ID,  Cost  ,    People

1 ,  10000,      20

2 ,  20000,      10

3 ,  30000,      10

];

Load

ID,

Sum(Cost)/sum(People) as [Cost/Person]

Resident Tabl1

GROUP BY ID;