# Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

Contributor

## 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

Tags (1)
1 Solution

Accepted Solutions
Honored Contributor III

## Re: PROBLEM OF DIFFERENCE OF SUM

Something like this?

= sum({\$} Sales) - sum(({AlternateState < G_product = \$::G_product> } Sales)

May you live in interesting times!
5 Replies
MVP

## Re: PROBLEM OF DIFFERENCE OF SUM

Kindly don't raise same question more than once..

difference between the two products

Honored Contributor III

## Re: PROBLEM OF DIFFERENCE OF SUM

Use "alternate states". Create two listboxes for Products, one of them in an alternate state.

= sum({\$} Sales) - sum(({AlternateState} Sales)

May you live in interesting times!
Contributor

## Re: PROBLEM OF DIFFERENCE OF SUM

it works thanks a lot

but i want to add a dimension take into account like group product sum(({AlternateState} (G_product) Sales)

Honored Contributor III

## Re: PROBLEM OF DIFFERENCE OF SUM

Something like this?

= sum({\$} Sales) - sum(({AlternateState < G_product = \$::G_product> } Sales)

May you live in interesting times!
Contributor

## Re: PROBLEM OF DIFFERENCE OF SUM

thanks a lot

you are the best

finally it's like this

=sum({[\$]}NBR_VOTE) - sum({groupe2 <LIB_ELECTION=\$::LIB_ELECTION>}NBR_VOTE)

but can you explain more the expression