Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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

1 Solution

Accepted Solutions
Highlighted
Creator III
Creator III

Re:Functions

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

View solution in original post

3 Replies
Highlighted
Creator III
Creator III

Re:Functions

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

View solution in original post

Highlighted
Partner
Partner

Re:Functions

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

Avg will be evaluated on that table

Highlighted

Re:Functions

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.