Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate values on same column

Hi,

i am very new to Qlikview and i have a simple question:

I have a table with the following structure:    

TypeQuantity
Sale5
Sale10
Return2
Sale15
Return5

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

12 Replies
MarcoWedel

You're welcome.

Glad it worked for you.

Marco

Not applicable
Author

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.

vishsaggi
Champion III
Champion III

May be this?

If(Type='Return', -Quantity,

IF(Type = 'Return', -Amount,

IF(Type <> 'Return', -Amount,

IF(Type <> 'Return', Quantity)))) as Negatives