
Re: Running/Cumulative Total Calculations
Gysbert Wassenaar Mar 9, 2015 11:10 AM (in response to Felipe Goitre)Perhaps this document helps: Calculating rolling nperiod totals, averages or other aggregations
If not, please post a qlikview document that demonstrates the problem.

Re: Running/Cumulative Total Calculations
Felipe Goitre Mar 10, 2015 10:05 AM (in response to Gysbert Wassenaar )Dear Gysbert
Attached you can find a QV file on which you can see a pivot chart and a line chart.
I will like to put on the line chart the column "Cost / 1000" of the pivot chart but when I use the same expression, the Line chart doesn't show the cumulative results.
If(RangeSum(above(sum(Production),0,12))=0,0,
(RangeSum(above(sum(Service),0,12))+RangeSum(above(sum(Spare),0,12)))*1000 / RangeSum(above(sum(Production),0,12)))
I am not sure if the formula can be used also on a line chart.
Please let me know.
thanks in advance
Felipe

Costx1000.qvw 167.8 K

Re: Running/Cumulative Total Calculations
Linus Blomberg Mar 10, 2015 10:09 AM (in response to Felipe Goitre)Use "before" instead of "above" in a chart.
If(RangeSum(before(sum(Production),0,12))=0,0,
(RangeSum(before(sum(Service),0,12))+RangeSum(before(sum(Spare),0,12)))*1000 / RangeSum(before(sum(Production),0,12)))

Re: Running/Cumulative Total Calculations
Felipe Goitre Mar 10, 2015 10:27 AM (in response to Linus Blomberg)Dear Linus
I have tried using "before" instead of "above" with no results...(no lines in the chart).

Re: Running/Cumulative Total Calculations
Felipe Goitre Mar 13, 2015 8:54 AM (in response to Felipe Goitre)Dear All
I have solved this issue using AsOf tables.
See as reference: Advanced accumulation with nullvalues
In Particular I did this:
Load
CPeriod as CumPeriod,
AddMonths(CPeriod,1IterNo()) as CPeriod
Resident ProdData
While IterNo()<=12;
On the Line chart, I change the Dimension from CPeriod to CumPeriod and the expresion become very simple:
(Sum(Service)+Sum(Spare)) * 1000 / sum(production).
Thanks again.





Re: Running/Cumulative Total Calculations
Linus Blomberg Mar 9, 2015 11:26 AM (in response to Felipe Goitre)Maybe my similar issue can help you out. Using AsOfTables is a smart way to control your cumulations.

Re: Running/Cumulative Total Calculations
Linus Blomberg Mar 9, 2015 11:28 AM (in response to Linus Blomberg)of course it was @Gysbert Wassenaar who help me out that time... Thanks again...
