Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
narender123
Specialist
Specialist

Range Sum

Hi All,

Could anybody tell me the range sum fuction.I dont know about it.when should we have to use it?

like:

RangeSum(Above(Sum(Amount),0,RowNo()))

RangeSum(Above(Sum(Amount),-1,RowNo()))

RangeSum(Above(Sum(Amount),1,RowNo()))

Thanks in advance.


1 Solution

Accepted Solutions
er_mohit
Master II
Master II

hiii

from helps you know the concept of rangesum its clear to you

nw in this 3 expression let me tell you one by one

RangeSum(Above(Sum(Amount),0,RowNo()))--- In this your accumulation starts from ist value which it writes as it is. because you write the 0 for that value and then for others vlue in row it accumulates

RangeSum(Above(Sum(Amount),1,RowNo()))-- in this your commulative starts from 2nd row and it will make first row as zero i hav attached sample file

RangeSum(Above(Sum(Amount),-1,RowNo()))- in this case it pick up 2nd value for accumlation means takes two values to be accumulated in my example first it take 20 then 20+30 acc. to condition and add 20 bove gives 70 then it gives you then it takes 70 accumulate then 30 and 50 gives you 150

and then gives 110 because of adding 50 and 60 and then 60

so on

hope it helps

View solution in original post

5 Replies
tresesco
MVP
MVP

The best place to learn the basics is HELP which says:

rangesum(expr1 [ , expr2, ... exprN ])

Returns the sum of a range of 1 to N arguments. As opposed to the + operator, rangesum will treat all non-numeric values as 0.

The argument expressions of this function may contain Chart Inter Record Functions with a third optional parameter, which in themselves return a range of values.

Examples:

rangesum (1,2,4)returns 7
rangesum (1,'xyz')returns 1
rangesum (null( ))returns 0
rangesum (above(count(x),-1,3))returns the sum of the three results of the count(x) function evaluated on the row below the current row, the current row and the row above the current row.

Then try a bit to play yourself with it. the concept will get clear.

Thanks.

narender123
Specialist
Specialist
Author

Thanks for the reply.

I have already read this and understand.But still i don't get my answer as per my question.So could you tell me according to my question.

Thanks.

er_mohit
Master II
Master II

hiii

from helps you know the concept of rangesum its clear to you

nw in this 3 expression let me tell you one by one

RangeSum(Above(Sum(Amount),0,RowNo()))--- In this your accumulation starts from ist value which it writes as it is. because you write the 0 for that value and then for others vlue in row it accumulates

RangeSum(Above(Sum(Amount),1,RowNo()))-- in this your commulative starts from 2nd row and it will make first row as zero i hav attached sample file

RangeSum(Above(Sum(Amount),-1,RowNo()))- in this case it pick up 2nd value for accumlation means takes two values to be accumulated in my example first it take 20 then 20+30 acc. to condition and add 20 bove gives 70 then it gives you then it takes 70 accumulate then 30 and 50 gives you 150

and then gives 110 because of adding 50 and 60 and then 60

so on

hope it helps

narender123
Specialist
Specialist
Author

Thanks Mohit.

owais_sarwar
Contributor II
Contributor II

Hello Mohit,

I am stuck in the same scenario which you have stated. I am still having a problem after applying this expression because i have multiple dimensions in a straight table. What should i need to do in this case.

I need to implement that if the user input the budget in the input box. The  straight table should show the rows till the time it reaches the Sum(Bugdet) <= VBudget. In other words may be i need the running total till the condition reaches.

If have written the set expression with if statement i.e.

=If(RangeSum( Above(TOTAL Sum([Rate]/2) , 0 , RowNo(TOTAL))) <= VBudget ,Num(Sum([Rate]/2),'#,##0'))

And after writing this expression, the dashboard is stuck. There may be an issue with the sorting technique.Your help would be highly appreciated in this regard.

Screenshots attached.Exp Not Working.png