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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
bbmmouha
Creator
Creator

PROBLEM OF DIFFERENCE OF SUM

i have a problem and i need help

i'm a debutant

i have a dimension that contain products for exemple A B C D E F

i want to see the difference between the two products that he selected

for exemple if he selected A B

sum(A) - sum(b)

if he selected A C

sum(A) - sum(C)

thanks for help

1 Solution

Accepted Solutions
robert_mika
MVP
MVP

5 Replies
robert_mika
MVP
MVP

Text box expression

=sum(if(Name=textbetween(GetFieldSelections(Name,',')&',',',',','),Amount))-sum(if(Name=textbetween(','&GetFieldSelections(Name,','),',',','),Amount))

Script

Load *  Inline

[

ID,Name, Amount

1,A,5

2,B,6

3,C,7

4,D,8

];

robert_mika
MVP
MVP

File

maxgro
MVP
MVP

maybe (in textbox)

=sum(if(Product=SubField(GetFieldSelections(Product,','),','), Amount))

-

sum(if(Product=SubField(GetFieldSelections(Product,','),',', 1), Amount))

bbmmouha
Creator
Creator
Author

thanks a lot

jagan
Partner - Champion III
Partner - Champion III

Hi,

You can also try this using Set Analysis.

=Sum({<Name={$(=SubField(Concat(Name, '|'), '|', 2))}>} Amount) - Sum({<Name={$(=SubField(Concat(Name, '|'), '|', 1))}>} Amount)

Regards,

Jagan.