Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all.
I have a straight table with a calculated column. To simplify things, let's say the table has a Dimension D with two columns of numeric data A and B. The calculated column has the expression C = (A*v) + B, where v is an input variable.
I have set the table to show totals, so once I have made my selection of dimensions, the bottom of the calculated column shows (correctly) the total of the calculations for each row.
My problem is, I need to know the correct syntax in an aggregation function, to calculate that total so I can assign it to a variable.
I have tried
sum(aggr((A*v)+B,D))
and
aggr(sum((A*v)+B),D)
and one or two others that I have now forgotten about, but I have lost confidence in my ability to write aggregation functions and wonder -
Could someone please tell me what the correct syntax should be? Or, advise if there is an easier way to emulate the total that appears at the bottom of the calculated column.
Many thanks,
Pete
OK I think I can answer myself here, after having another look at my syntax.
The expression
sum(aggr((A*v)+B,D))
appears to be the correct one after all.
I think the complications in the real-life example I had, where there were several other columns involved, threw me off track.
I would still be interested, though, as to whether there is an easier way...?
Regards,
Pete
I would have expected that you would want AGGR(SUM((A*v)+B),D)
Thanks Michael.
That’s what I would have thought initially too, but it is not what worked.
It is a little bit confusing to me, but at the moment I am inclined to go with what appears to be giving me the right result and try to figure it all out later.
Regards,
Pete