Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

3 Replies
Not applicable
Author

Try to use:

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

Not applicable
Author

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

Anonymous
Not applicable
Author

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?