Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
manisha10
Contributor III
Contributor III

To calculate Amount divided by total amount for a variable - Qlik Sense

Hi I have a measure 

sum(if(assetclass = 'A', Amount/oustandingAmount))

Desired output: for asset class A this should get calculated: (sum(Amount/ sum(OustandingAmount)))*100

I tried this: sum(if(assetclass = 'A', sum(Amount/sum(oustandingAmount)))*100) Nested sum is not allowed in measures.

Can you suggest any alternative? 

Thank you!

 

Qlik Sense Business 

 

1 Solution

Accepted Solutions
rubenmarin

Hi @sunny_talwar, you're right as always:

Sum({<assetclass={'A'}>} Amount)/sum({<assetclass={'A'}>} oustandingAmount)*100

Or maybe you are looking for:

Sum({<assetclass={'A'}>} Amount)/sum(TOTAL {<assetclass={'A'}>} oustandingAmount)*100

Best regards 😊

View solution in original post

4 Replies
rubenmarin

Hi, using an if inside a Sum gives worst performance than using set analysis. also using set analysis you don't need the first if and the expression can be:

Sum({<assetclass={'A'}>} Amount)/sum(<assetclass={'A'}>} oustandingAmount)*100

Or maybe you are looking for:

Sum({<assetclass={'A'}>} Amount)/sum(TOTAL <assetclass={'A'}>} oustandingAmount)*100

sunny_talwar

@rubenmarin  you missed opening { in the denominator expressions of both of your expressions above

rubenmarin

Hi @sunny_talwar, you're right as always:

Sum({<assetclass={'A'}>} Amount)/sum({<assetclass={'A'}>} oustandingAmount)*100

Or maybe you are looking for:

Sum({<assetclass={'A'}>} Amount)/sum(TOTAL {<assetclass={'A'}>} oustandingAmount)*100

Best regards 😊

manisha10
Contributor III
Contributor III
Author

@rubenmarin  Thanks a lot!! it worked! 🙂