Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What is the means by rangeavg(above(Sum([Billing Sales Amount_NETWR]),0,3))

What is the means by rangeavg(above(Sum([Billing Sales Amount_NETWR]),0,3))

Plz tell

5 Replies
its_anandrjs

Hi,

RangeAvg is ths Aggregate function and it is used for calculate the average of the expression of current row. But it is calculate the average of Sum([Billing Sales Amount_NETWR]) above 2 rows of the given table.

Regards

Anand

SunilChauhan
Champion II
Champion II

it will sum the 3 previous value of  Billing salesamount_Netwr

for example you have data like below

ID,Billing salesamount_Netwr

1,100

2,200

3,300

then it will give you 600 as output.

or for more clear

ID,Billing salesamount_Netwr

1,100

1,300

2,200

2 200

3,300

then  sumof Billing salesamount_Netwr give you below result

1.400  ---------------------->  sum of ID=1 amount(100+300)

2.400------------------------>   sum of  ID=2 amount(200+200)

3.300------------------------>   sum of  ID=3 amount(300)

and

rangeavg(above(Sum([Billing Sales Amount_NETWR]),0,3))

will give you below result

1.400 ----------------------> sum of  current amount+ 2 previous amount i.e for ID (400+0+0) as no 1+2 previous value

2.800   ----------------------> sum of  current amount+ 2 previous amount i.e for ID (400+400+0) as no 2 previous value

3.1100 ----------------------> sum of  current amount+ 2 previous amount i.e for ID (300+400+400)

hope this helps

Sunil Chauhan
its_anandrjs

Hi,

Assume this example for the RangeSum and RangeAvg explanation

Sample_Int:
LOAD * INLINE [
Month, Sales
Jan-09, 55
Feb-09, 39
Mar-09, 33
Apr-09, 56
May-09, 55
Jun-09, 70
Jul-09, 57
Aug-09, 29
Sep-09, 34
Oct-09, 41
Nov-09, 12
Dec-09, 11
]
;

And in the front end take

Dim:- Month

Expre:- =RangeAvg(above(Sum(Sales),0,3))


And Out put you get

  

MonthRangeAvg(above(Sum(Sales),0,3))Sum(Sales)
Jan-0955.0055
Feb-0947.0039
Mar-0942.3333
Apr-0942.6756
May-0948.0055
Jun-0960.3370
Jul-0960.6757
Aug-0952.0029
Sep-0940.0034
Oct-0934.6741
Nov-0929.0012
Dec-0921.3311

=RangeAvg(above(Sum(Sales),0,3))  this calculates the Range average below 3 rows


For Jan-09 (55)

For Feb-09 (55, 39)

For Mar-09 (55,39,33)

For Apr-09 (39,33,56)

Till this ways


Regards

Anand

Anonymous
Not applicable
Author

Hi,

rangeavg(above(Sum([Billing Sales Amount_NETWR]),0,3))

Above expression calculates avg of rolling n months of  Billingsales,0 value means current row and 3 means counting from current to updwards 3 rows are taken into consideration to calculate avg of range specified.

please refer to below link for rolling n months example,which can be implemented for any RangeXXX functions:

http://community.qlik.com/docs/DOC-4252

Not applicable
Author

rangeavg(above(Sum([Billing Sales Amount_NETWR]),0,3))

means:

Take the current Row [Billing Sales Amount_NETWR] and TWO(2) rows above the current position (to make 3 rows in total) and then compute the Average based on the SUM of them.

ie:

10

20 X if this is the current position, it will do average of 20 + 10 /2

30  X if this the current position, it will do average of 30+20+10 /3

40

Hope this helps.