Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rangesum aggregation script

Hi

I have a table that contains

Meter
  Number
Days in serviceDateDaily Production
1101/01/201011
1202/01/201013
1303/01/201018
1404/01/201011
1505/01/201012
2103/01/20105
2204/01/201016
2305/01/201020
3102/01/201017
3203/01/20106
3304/01/20107
3405/01/201013
3506/01/20107

I want to add accumulate the daily production column by meter number. I am not bothered if this is in the script or on a chart.

I am sure I have all the igrediants to make this possible, however none of the example Rangesums, aggregation examples seem to work for me. Please advise

The table should read

Meter
  Number
Days in serviceDateDaily ProductionTotal_Produced
1101/01/20101111
1202/01/20101324
1303/01/20101842
1404/01/20101153
1505/01/20101265
2103/01/201055
2204/01/20101621
2305/01/20102041
3102/01/20101717
3203/01/2010623
3304/01/2010730
3405/01/20101343
3506/01/2010750

Many thanks in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached example. The inline load is just an example to load some sample data. Replace it with your actual load statement.


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Gysbert_Wassenaar

See attached example. The inline load is just an example to load some sample data. Replace it with your actual load statement.


talk is cheap, supply exceeds demand
Not applicable
Author

Many Thanks

Worked a treat

Not applicable
Author

Hi

    Can u tel me the exact use of rangesum function.

angelaecheverri
Creator
Creator

Try loading your script  using Peek function:

First Load your Table, using a name for it. Example:

Original_Base:

Load

Meter_Number,

Day_in_service,

Date,

Daily_Production

From

xxxx

then make a resident table, using Peek function and Order by.... like this....

Final_Base:

Load

Meter_Number          as Meter_Number_2,

Day_in_service          as Day_In_Servivce_2,    

Date                         as Date_2,

Daily_Production        as Daily_Production_2,

Peek(Daily_Production) + Daily_Production as Total_Produced

Resident

Original_Base

Order by Date asc;

note: you dont need to rename your new fields... but i like to do it in order to compare results...

if you dont do it at the end you need it to make a drop table sentence....


Drop table Original_Base;

angelaecheverri
Creator
Creator

If you want to use range sum

you can try:

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

or

RangeSum(Above(TOTAL Sum(Sales), 0,RowNo(TOTAL)))


The first one acum your sales by dimension.

The second one acum without thinking of change dimensions....


Look the image....

Captura.PNG.png

qv_testing
Specialist II
Specialist II

Hi Richard,

Try this....

Rangesum(above(sum([Daily Production]),0,rowno(total)))

Anonymous
Not applicable
Author

Powerful function this Rangesum.

saved some coding for me

Thanks Gysbert