Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Group By and Average at Script level

Hey,

i want to calculate the following scenario...

ID  Amount

1     10

1     10

1     10

2     20    

2     20

3     30

3     30

3     30

3     30

i want to group by id and calculate average of amount at script level.

Utsav

1 Solution

Accepted Solutions
er_mohit
Honored Contributor II

Re: Group By and Average at Script level

hi try this

a:

LOAD * INLINE [

    id, amount

    1, 10

    1, 10

    1, 10

    2, 20

    2, 20

    3, 30

    3, 30

    3, 30

    3, 30

];

LOAD

Avg(amount)as avg_amount

Resident a

Group by id;

hope it helps

4 Replies
Not applicable

Re: Group By and Average at Script level

hi

try this

LOAD id,sum(amount) as sumamount,

     avg(amount) as avgamount

FROM

(ooxml, embedded labels, table is Sheet1) Group by id;

sujeetsingh
Honored Contributor III

Re: Group By and Average at Script level

utsav u can do it in ui level very easily ....

Juast by takinmg your id as dimention ..

er_mohit
Honored Contributor II

Re: Group By and Average at Script level

hi try this

a:

LOAD * INLINE [

    id, amount

    1, 10

    1, 10

    1, 10

    2, 20

    2, 20

    3, 30

    3, 30

    3, 30

    3, 30

];

LOAD

Avg(amount)as avg_amount

Resident a

Group by id;

hope it helps

khadeer_sparks
Valued Contributor

Re: Group By and Average at Script level

Aggr function works for that

aggr(avg(Amount),Id)

Community Browser