Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
AdamValle
Contributor
Contributor

How to Sum/Rest Negatives and positives in the same column

Hello everybody, 

I'm new in the QlikSense world, so I'll be greatful if someone could help me.

I have a datasheet called Movements. In that datasheet, there's a column called moves, which contains 10 diferents movements. All of the movements are about stocks, which means that if we buy something and arrives to our warehouse, the movement is positive cause increase our stock. But when we sell, the movement is negative. 

 

Example:

SELL      2

BUY        9

BUY        3

SELL      7

In this cause, the total should be 3.   

How can i indicate the movements that are positives or negatives and calculate it in the same column?

Thank you so much!

2 Replies
tresesco
MVP
MVP

Try like:

=Sum(If(movement='SELL', -stock, stock))

 

AdamValle
Contributor
Contributor
Author

Hello Tresesco, 

Thanks for your reply. 

The moves that Sum are the number 10, 11, 12, 13 and 14. And the ones that rest are  6, 7, 8 and 9.

And the field is called Moves.

So, it should be like:

=Sum(If(Moves='10', '11', '12', '13', '14', -Moves, Moves)) ??

Thank you