logo
Powered by QM on a Rpi server

KnowledgeBase 00042: The CUMULATIVE Keyword

Last updated: 22 Jul 2016
Applies to: All versions
Search  
Top level index       Full Index Search Tips
Previous article     Next article

This article was originally published as a Tip of the Week.

It is often useful to maintain a running total for a field in a query processor report. The CUMULATIVE keyword provides an easy way to do this.

CUMULATIVE is an arithmetic qualifier and can be used in the display clause just like TOTAL, AVERAGE, etc.


Example

The following simple example is based on QM's sales processing demonstration database.

list sales by cust break.on "'OL'" cust item qty price line.value cumulative line.value col.hdg "Total" 
SALES.....   Cust   Item    Qty    Price   Line Total   Total. 
12001        1000    001      2     1.70         3.40     3.40 
                     003      1     1.70         1.70     5.10 
12333                013      1     0.30         0.30     5.40 
                     032      6     1.90        11.40    16.80 
                     055      6     2.87        17.22    34.02 
                     041      5     0.50         2.50    36.52 
12371                012      6     0.30         1.80    38.32 
                     002      6     1.70        10.20    48.52 
                     032      5     1.90         9.50    58.02 
                     054      6     0.99         5.94    63.96 

12157 1001 013 6 0.30 1.80 1.80 12293 100 2 52.50 105.00 106.80 12019 017 3 5.20 15.60 122.40 122 5 44.50 222.50 344.90 240 6 4.00 24.00 368.90 12003 012 5 0.28 1.40 370.30 013 20 0.28 5.60 375.90 12233 013 1 0.30 0.30 376.20 123 1 62.00 62.00 438.20 240 5 4.00 20.00 458.20


Related Articles

None.



Please tell us if this article was helpful
Very     Slightly     Not at all
Comments
Email (optional)