Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Combining transaction amounts (credit and debit)?

Hello,

I'm not quite sure how to phrase this so I've given an example below.

I'm having issues combining amounts for a location where inventory is moved from one section to another and a transaction occurs much like a debit and credit (a positive amount and a negative amount net 0)

I have a user who would like to see a location, or section, and see the transactions associated with it. 

For example, a user would like to pick Loc1 and see the net of the amount moved and each transaction whether the section is a source or destination.  The example below would net 150 as the transactions on 1/21 would cancel each other out and I would be left with the amount on 2/1.  The amounts, however, are always positive and if I simply used a SourceSection or DestSection as a selection criteria, I would be left with wrong data as amounts would not cancel each other out.

LocationTransNoSourceItemSourceSectionDestItemDestSectionDateAmount
A11Item1Loc1Item2Loc21/21/14150
A12Item2Loc2Item1Loc11/21/14150
A13Item1Loc1Item2Loc22/1/14150

I'm thinking I need a "master" table and then split the table above into a source and destination table, but I'm not quite sure how to go about doing this.

Any help would be greatly appreciated.

Thank you in advance.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

just un idea, hope it helps

View solution in original post

4 Replies
maxgro
MVP
MVP

just un idea, hope it helps

iktrayanov
Creator III
Creator III

Maybe you should create a table like this

Location,

TransNo,

Item,

Section,

Amount,

Date,

Credit_DebitFlag \\ this should be 1 or -1 and will give you a way to calculate your amounts

iktrayanov
Creator III
Creator III

this is how you example data will look like.

LocationTransNoItemSectionDateAmountCredit_DebitFlag
A11Item1Loc11/21/2014150-1
A11Item2Loc21/21/20141501
A12Item2Loc21/21/2014150-1
A12Item1Loc11/21/20141501
A13Item1Loc12/1/2014150-1
A13Item2Loc22/1/20141501
Anonymous
Not applicable
Author

Massimo,

This is perfect and exactly what I was looking to emulate.  Thank you so much!