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: 
Not applicable

Negative value based on type of transaction

Hi, I am very new to Qlikview and am hoping to get some help on something I am stuck on.  We had a QV developer build some reports for us already, and I am trying to expand on them.  We have a report that shows Gold and Silver analysis of our product, with style listed and price that includes invoiced as well as return (credit) transactions.  I want to get a total # of the units invoiced or credited, and this is the expression the developer added so far for a unit count:

SUM({<StyleLine={'Designer Gold'},Revenue_Flag={'1'}>} TranItem_Quantity)

This expression works in that it is totalling all of the items in the transaction, however for items on credit transactions I want it to count them as negative units.  Would I need to add another expression below the one above to count credit transaction types as a negative, and how would the expression look?  Any help would be greatly appreciated!

1 Reply
Not applicable
Author

Maybe you could add a column in your load script.

if(expression_to_evaluate_credit = 1, -1, 1) as TranItem_Quantity2

The idea is to have a field that if is a normal transaction assignes 1, if is a credit transaction -1.

So in your sum(TranItem_Quantity2), you'll be counting what you need