Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
maahivee
Contributor III
Contributor III

Adding and subtracting in the same field

Hello Guys,

I have a situation where i have to add two columns and subtract another from it in the same field, i wrote the following expression to do that 

Exp :  Sum([Qty On Hand])+Sum([Purchase Quantity])-Sum([Sales Quantity])

Dimensions : Date and Item Number

At first it worked fine but then i was asked to change it in such a way that it should start counting with Qty on hand first and then should add if its purchase quantity and subtract if its sales quantity for each row.

to do that i did the following expression , Keeping in mind that column(4) here is the 1st expression here.

RangeSum(Above(TOTAL Column(4), 0, NoOfRows(TOTAL)))

it working only if i select an item number

and is not working if i don't make any selection on item number, it is just giving error and not loading the entire sheet.

Please help!!!


3 Replies
MK_QSL
MVP
MVP

Try

RangeSum(Above(Column(4), 0,RowNo()))

maahivee
Contributor III
Contributor III
Author

Hey I have tried this and the problem is, it should be adding or subtracting to the above row based on the sales order or purchase  order.

but it is not doing that instead just showing if it would be -ve or +ve value.

petter
Partner - Champion III
Partner - Champion III

Could you share your App or a demo/test version of it?