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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
oxiofrt
Partner - Creator
Partner - Creator

Rangesum complex (?) issue

Hi,

I have created a table containing a limited number of columns.

Sort order is important in that table :

1 : weight

2 : order (useful in case of equality of weight)

The Qlikview  document herejoined contains the table with a few date, and a screenshot detailing what is the expected result.

I have tried several ways to do it, without success. It probably needs to use rangesum function but I don't know how to specifiy the dimensions on which the rangesum should be applicated.

Thank you for your help !

12 Replies
swuehl
MVP
MVP

Is the result depending on selections you make? If not, maybe it would be best to do the complete calculation in the script.

Meanwhile, I was wondering if our calculation is correct at all. You are telling in your qvw, that

we need to sum values for agent 2012123 (in first line) where weight >=10 and order >14.

Why do you add C7 (weight = 😎 then?

oxiofrt
Partner - Creator
Partner - Creator
Author

Well I may have been clearer...

The aim is to sum for each agent the column WEIGHT, only for lines where ORDER is > to the ORDER value of the  current line.

For agent 2012123 and line 1, it shoud sum all WEIGHT values for this agent where ORDER is > 14.

For agent 2012123 and line 5, it shoud sum all WEIGHT values for this agent where ORDER is > 15.

Result has to be calculated according to sélections.

Thanks a lot for all the precious help provided.

swuehl
MVP
MVP

Ok.

Does my above suggested solution works for you?

Sorting the load order should not be a big issue, it's enough to create a table first in the script with all possible ORDER values:

TMP: // table must appear in your script before you load ORDER from your sources

LOAD recno() as ORDER

Autogenerate 1000; // assuming range ORDER from 1 to max 1000

Then execute your script. You can even DROP TABLE TMP; at the end of the script, if you want.