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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum function issue

Hi

Have a expression like below

sum(if (conditions, field ))

This working fine

But when try to get the total value

sum( total if (condition, field )) condition filter is not applied .

Getting the sum of all values .

7 Replies
its_anandrjs
Champion III
Champion III

Update

Try like this way

This statement is wrong All and Total not working this way because it is in the if condtion

sum(if (conditions, TOTAL field ))

Try one of this

Sum(TOTAL if (conditions, field ))

Or

Sum(ALL if (conditions, field ))

Not applicable
Author

that works fine... refer to the attachment

Not applicable
Author

Have used the same formula, But I need to add that formula in expression in chart.

There its not working.

Not applicable
Author

Giving a syntax error

Not applicable
Author

can u share ur qvw?

its_anandrjs
Champion III
Champion III

Thats right

Try with this way

Sum(TOTAL if (conditions, field ))

its_anandrjs
Champion III
Champion III

See this small example

Raw:

load * Inline

[

Name,empid,salvalue

A,101,45000

B,102,30000

C,103,15000

D,104,20000

];

And in straight table

Dimension:- Name

Expression:- =Sum(TOTAL   if (salvalue>20000,   salvalue))

Result will be

Name,salvalue

101,75000

102,75000

103,75000

104,75000

What expected output you need.

Hope this helps