Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum function

HI ,

in my chart i am using the expression

=sum( {$<[Job discipline] = {"10"}, [Expense group] = {"Other"}>} Cost* BaseToSEKRate / AverageRate )

For a particular job number

The cost value is 600 , BaseToSEKRate is 5 and AverageRate is 5 . and

cost value is 0 , BaseToSEKRate is 5 and AverageRate is 5

now my expression has to give me 600 as output but due to duplicate records it is giving 1200 .

What i can do so that it will not take the duplicate records into consideration.

Please suggest.

2 Replies
senpradip007
Specialist III
Specialist III

Hi Avi Avinash,

you can try with the following expression

=sum({$<[Job discipline] = {"10"}, [Expense group] = {"Other"}>} Distinct Cost * BaseToSEKRate / AverageRate )

Hope it will help you.

Not applicable
Author

Hi PR@D!P,

Thanks fo rthe reply. I tried it earlier it is working fine but my question is .

if i have a record like this

jobnumber, cost,  BaseToSEKRate, AverageRate , type

1 ,600,5,5,A

1,600,5,5,B

1,600,5,5,A

.

Will it eliminate only the record 1,600,5,5,A since we are already having 1,600,5,5,A(in this case o/p will be 1200)

or both

1,600,5,5,B

1,600,5,5,A and give o/p 600