3 Replies Latest reply: Jun 12, 2015 4:22 PM by Chris Duke

# sum(Total \$(Variablename)

I am trying to use a varialbe in an expression. I am sure the syntax is correct but it does not seem to be working. Very frustrating!!!

=\$(vTotalCostofQual)

This variable works fine.

=sum(\$(vTotalCostofQual))/sum(TOTAL(\$(vTotalCostofQual)))

This does not.

I need to find the Total Cost of Qual as a % of the overall cost of Qual.

The Variable is created in the book not in the script.

count({<[Call Category]={'Fault'}>} DISTINCT CallID)*vCallCost+

sum({<[SOP Type]={'Return'}>} [Extended Price])+

count({<[Call Type]={'RTB - F'}>}distinct [CallID])*vRTBCost+

sum({<type = {'Other'}>} quant * [WebPrice.Standard Cost])+

count([New Gpid])*(vUPS+vPick)+

sum({<type = {'Accessory'}>} quant * [WebPrice.Standard Cost])+

sum({<type = {'Accessory'}>} quant * vPick)

Above is the expresssion that is in the variable,

Any help would be most appreciated.

Richard

• ###### sum(Total \$(Variablename)

Try to use:

sum(aggr(\$(vTotalCostofQual), Dimension) )/sum(TOTAL aggr(\$(vTotalCostofQual), Dimension)

• ###### sum(Total \$(Variablename)

Still was not working,

I had a thought and created another vaiable which had the TOTAL qualifier in and just divided one by the other. Worked fine.

Thank you for your help though, you put me onto the right line.

Rich

• ###### Re: sum(Total \$(Variablename)

Hi Rich,

I'm having the same issue that you solved. Can you show the formula or explain how you added the TOTAL qualifier to your variable seeing as it has several calculations?