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: 
capriconuser
Creator
Creator

subtract two expression in qlikview

i have expression like this 

sum({code={'654','2','131'}>} Amount) 

+

(fabs(sum(distinct{<category={'1005'},code={'2'}>} Amount}

-

fabs(sum(distinct{<category={'1005'},code{'45'}>} Amount )))

 

+

sum(distinct{<category={'12','34','56','78','90'},code={'56'}>} Amount )

 

now the second expression which is  

(fabs(sum(distinct{<category={'1005'},code={'2'}>} Amount}

-

fabs(sum(distinct{<category={'1005'},code{'45'}>} Amount )))

 

 

i want to modify this only in 1 line like this look category is same but code is different so is this possible to subtract like this ?

(fabs(sum(distinct{<category={'1005'},code={'2'} - code ={'45'}>} Amount} 

 

 

any help

3 Replies
NhanNguyen
Contributor III
Contributor III

This should work?

(fabs(sum(distinct{<category= {1005,2} - {45}>} Amount} 

capriconuser
Creator
Creator
Author

no.

 

(fabs(sum(distinct{<category= {1005,2} - {45}>} Amount} 

here category is only 1005 and transaction code are 2 and 45 .. so i  want minus between codes not categories 

NhanNguyen
Contributor III
Contributor III

Ok, now I understand. A one-line expression like you proposed is not working since set analysis will exclude data not deduct values. So you must write 2 expressions.