Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Help with adding an expression

Hi, i want to create an expression for the following....

we have several thousand transaction ID numbers (Transid) with a number of products against each (SalesQuantity). I would like to create an expression which will only display TRANSIDs with 2 or more SALESQUANTITY against them. Its gets more difficult as some transaction id's have duplicates (but with a different product against it) so i would like it to total up the duplicate Transid's.

E.g

Transid SalesQuantity

211125 1

211125 3

211131 2

211139 1

211144 1

i would like the expression only to display the Transid:

211125 (as this totals to 4 products)

211131 (as this totals to 2)

but not to display the latter 2 Transid's as these are less than 2.

Can anyone help??

4 Replies
Not applicable

hi,

try the following in your script

tab1:

LOAD * INLINE [

TransId, SalesQuantity

211125, 1

211125, 3

211131, 2

211139, 1

211144, 1

];

load TransId,sum(SalesQuantity) as sum resident tab1 group by TransId;



thanks

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi, thanks for your reply, the data given in my original post is an example. i have thousands of transaction id's and they grow by several thousand every day, so typing the id's in a script obviously can't be done.

Does anyone have any other ideas?

Not applicable

hi, you can store your transactionid's and salesquantity in excel and load that excel file instead of wrirting all the id's in script tab1: load TransId,SalesQuantity from abc.xls ; tab2: load TransId,sum(SalesQuantity) as sum from abc.xls group by TransId; thanks
sparur
Specialist II
Specialist II

As tauqueer said:

ResultTable:

load

TransId,

sum(SalesQuantity) as sumQuantity

resident TransactionTable

group by TransId;