Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
t_vijay_qlik
Contributor III
Contributor III

Re:Functions

Hi all,

Can any one explain the precedence in which the expressions in funtions are beign evaluated

for example

Avg(Aggr(Sum(UnitSales*UnitPrice), Customer))


ProductData:

LOAD * inline [

Customer|Product|UnitSales|UnitPrice

Astrida|AA|4|16

Astrida|AA|10|15

Astrida|BB|9|9

Betacab|BB|5|10

Betacab|CC|2|20

Betacab|DD|25|25

Canutility|AA|8|15

Canutility|CC||19

] (delimiter is '|');

Thanks

vijay kumar

Labels (1)
1 Solution

Accepted Solutions
kfoudhaily
Partner - Creator III
Partner - Creator III

this is the avrage sales amount=Sum(UnitSales*UnitPrice) grouped by customer.

QlikView Qlik Sense consultant

View solution in original post

3 Replies
kfoudhaily
Partner - Creator III
Partner - Creator III

this is the avrage sales amount=Sum(UnitSales*UnitPrice) grouped by customer.

QlikView Qlik Sense consultant
fabdulazeez
Partner - Creator III
Partner - Creator III

Aggr will build a internal temporary table with 2 columns  Sum(UnitSales*UnitPrice) and customer.

Avg will be evaluated on that table

BalaBhaskar_Qlik
Master
Master

1st - By - Aggr(Sum(UnitSales*UnitPrice),Customer) expression

       For each Customer, it calculates - Sum(UnitSales*UnitPrice) -

       So - Customer wise - Astrida - 4*16 + 10*15 + 9*9 = 295,

                             - Betacab - 5*10 + 2*20 + 25*25 = 715

                             - Canutility - 8*15 = 120

Now the above Aggr() function is having values, as - 295,715,120.

2nd - The above values are passed as Input to Avg function -

        Then it'll be like - Avg(295,715,120) - It calculates Avg of those 3 values & output will be: 376.66.

So this is the process happens with the above expression.