7 Replies Latest reply: Mar 2, 2018 10:33 AM by Fabiana Iglesias

# Rangesum and variables

Hi,

I need to accumulate the results of the expression "Sales*Percentage" in Qlik Sense Desktop.

I´,ve tried this options:

1. RangeSum(Above(\$(vSales), 0, RowNo())),

where \$(vSales) = sum({<IDAccount={'40'}>}Sales*Percentage

2. RangeSum(Above((sum({<IDAccount={'40'}>}Sales*Percentage)), 0, RowNo())),

And I have the results but they are not cummulative

I need a clue to solve this.

• ###### Re: Rangesum and variables

Do you have more than one dimensions? May be this

RangeSum(Above(TOTAL Sum({<IDAccount={'40'}>}Sales*Percentage), 0, RowNo(TOTAL)))

• ###### Re: Rangesum and variables

Thanks Sunny, you are the best!!

And can I replace the whole sum by the variable \$(vSales)?

• ###### Re: Rangesum and variables

I believe you should be able to do that

• ###### Re: Rangesum and variables

Great Sunny! It worked!

and I have a last question.

I to use an expression like this:

RangeSum(Above(Sum(Sales), 0, RowNo())) / Sum(total Sales)

but in my case, I need to use \$(vSales) instead of Sales.

I used this:

RangeSum(Above(Total \$(vSales), 0, RowNo(Total))) / Sum(total \$(vSales))

But it didn´t worked.

Could you please tell me what the mistake is?

• ###### Re: Rangesum and variables

I think since vSales is already Sum(Sales), you cannot really do this Sum(TOTAL Sum(Sales))... you will either need to create a new variable like this Sum(TOTAL Sales) or specify the whole expression here

• ###### Re: Rangesum and variables

I tried this:

RangeSum(Above(TOTAL \$(vVentas), 0, RowNo(TOTAL))) / \$(vSales)

where \$(vSales) is:

sum({<IDAccount={'40'}>}Total Sales*Percentage)

but it didn´t worked

• ###### Re: Rangesum and variables

I found another mistake and solved it.

It´s working now.

I appreciatte so much your help.

Thanks Sunny!