it seems, sum function is not working with column() / label name of column. But Rangesum is working..
sum(column(7)) -> gives 0 but rangesum(column(7)) gives values
so, you can try like
=[Total cost]/Rangesum(sum(TOTAL [2015 price]*[2015 Quantity]),
sum(TOTAL [2016 Price]*[2016 Quantity]))
Here, [Total cost] is a Label name and check the Relative option..
Suggestion : Instead of using column(1), column(2) , You can directly use the label name.
like [2015 price]*[2015 Quantity] (careful with your original field name)
test_comm.qvw 155.5 K
The Column() function and references to the expression name operate on a strictly row-by-row basis. It is not possible to use multirow aggregations like Sum, but the inter-record functions Above() and Below() work. It is possible to use this construct in place of Sum(Column(1)):
=Rangesum(Above(Column(1), 1, NoOfRows(TOTAL)))+RangeSum(Below(Column(1), 0, NoOfRows(TOTAL)))
(or with column names)
But it may be better to use the expression as max dreamer says, although you may need to wrap the expression in Sum(Aggr(...))
Like I said my calculations are very complex in the qvd I am developing with a vast amount of variables. So using the column names is not the solution. I just do not understand why QlikView does not have this functionality to use sum and column.
On another note, thank you Jonathan! It works perfectly now.
Thank you everyone for your help, really appreciate it!