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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Shiva123
Creator
Creator

Sum Function Not working Properly

hey ,

         everyone i have this issue which is a simple expression, at the designer end (Front end) is its working fine but at the script level it is not doing the exact calculation as the front end . The calculation here is  Amount / Quantity, where in some of the Amount's are negative and some of the Quantity are Zero's, my question is here is these two factors are causing the problem is there any way t resolve this or a better way to write the expression in script.

Thanks,

Shiva

12 Replies
Shiva123
Creator
Creator
Author

throwing an error for Parenthesis, so i did like this

(if(QTY =0,0,sum(USD) /Sum(QTY)))as [NEW FIELD]

Anil_Babu_Samineni

Expression seems okay, Now share full script or what you are trying?

(if(QTY =0,0,sum(USD) /Sum(QTY))) as [NEW FIELD]

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

May be try this

Alt(Sum(USD)/Sum(QTY), 0) as [NEW FIELD]

Or this

If(QTY = 0, 0, Sum(USD)/Sum(QTY)) as [NEW FIELD]