Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ranibosch
Creator
Creator

Sum if formula in function

Hi, my table looks as follows:

packsize issue.JPG

I would like my object to calculate the number of units sold.

Basically my calculation should work as follows:

For each ITEM NO do the following:

           sum (Invoice Quantity)

      -------------------------------------        and then sum this answer for all items in the end.

            packsize UOM

how do i write this on my object to calculate like this???

17 Replies
ranibosch
Creator
Creator
Author

not  working..

sum ( ( aggr ( sum ({ < [Trending Value] = {"MP"} > } [Invoiced Quantity]) / [Packsize UOM] , [Item no] ) ) )nodata.JPG

pradosh_thakur
Master II
Master II

what is the field that contains Hand acked and Machine Packed?

will you be able to share a sample app?

if your data is confidential then use the below procedure .

Preparing examples for Upload - Reduction and Data Scrambling

Learning never stops.
ranibosch
Creator
Creator
Author

current table.JPG

Unfortunately I will not be able to share a model..

See my current table below with highlighted fields:

     FIELD NAME          VALUE IN FIELD                                     COMMENT

1. Item No =                 Item 1; Item 2; Item 3                              List of item number

2. Invoice quantity =      300; 400; 500                                        Quantities sold per transaction

3. Trending value =      MP; HP                                                   Machine or hand packed

4. Packsize UOM =      10, 20, 50                                                Item specific pack size, not all items are the same

So my graph needs 2 lines, 1 for machine pack and 1 for hand packing in order to trend my units sold.

Total units is calculated by looking at each item individually (as items do not all have the same  unit weight). This can be done in math terms as follows:

a.   sum [Invoice quantity] of each item;   

b.   then divide a by each items' Packsize UOM;  

c.   then sum the total of a & b.

prma7799
Master III
Master III

Can you please upload some sample / scramble data?

ranibosch
Creator
Creator
Author

PLEASE FIND ATTACHED.

ranibosch
Creator
Creator
Author

DO YOU THINK PERHAPS I SHOULD CREATE A NEW FIELD ON MY ValueEntries table CALLED UNITS SOLD?

should i rather create a units field in my script. would that simplify things?

prma7799
Master III
Master III

Hi Rani,

Please share some expected output...

Thanks

PM

ranibosch
Creator
Creator
Author

attached i've included data and expected output..