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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
balasundaram
Creator II
Creator II

how to add?

='Total '& Count([Moc.Type  .])+Count(Moc.Type.)

above expression i written in under presentation tab in "TEXT IN CHART" , i am trying to show total count,but i used sum not working

10 Replies
IAMDV
Master II
Master II

Good to know it works for you. But it's not QlikView's fault but that's natural behaviour in programming paradigm. The reason for this behaviour is the nature of the operators used in the expression and the order of precedence. I would recommend you to read - The Order of Precedence of arthimetic operators for clear understanding. However, Let me try to explain:

='Total '& (Count([Moc.Type  .]) + Count([Moc.Type.]))


Above expression won't work without the brackets (in red colour) because we are using "+"/addition arthimetic operator and when we use the brackets then QlikView aggregates the both the count values and then adds them together. So if there are no brackets the expression evaulation might be confusing with the string concatenation operator and it returns a NULL value.


However, below expression works without the same brackets when we use the "*"/multiplier arthimetic operator because this operator take first precedence when we don't specify any brackets.

='Total '& Count([Moc.Type  .]) * Count([Moc.Type.])


So, it's important to explicity specify the brackets whenever writing the expressions and not depending on the Order of precedence.


I hope all this makes sense!


Cheers,

DV


www.QlikShare.com