Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i am very new to Qlikview and i have a simple question:
I have a table with the following structure:
Type | Quantity |
---|---|
Sale | 5 |
Sale | 10 |
Return | 2 |
Sale | 15 |
Return | 5 |
I want to add all Sales and subtract all Returns. So, for this example, i want to calculate the:
(5+10+15)-(2+5)
Althougth i searched it on the internet, i wasn't able to find something helpful. So, any advice will be approciated.
Thanks in advance and sorry for my bad english,
Michael
You're welcome.
Glad it worked for you.
Marco
I have one more question: i would like to set a negative value to other fields also. For example, beside Quantity, i would like to set negative also the Amount. Something like:
If(Type='Return',[-Quantity, -Amount],Quantity,Amount) as Negatives
Ofcourse the syntax is wrong, but i assume that it would be something like that.
May be this?
If(Type='Return', -Quantity,
IF(Type = 'Return', -Amount,
IF(Type <> 'Return', -Amount,
IF(Type <> 'Return', Quantity)))) as Negatives