Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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
pradosh_thakur
Master II
Master II

1:Use a straight table

2: dimesnion : [Item no]

3: expression sum([Invoice qty])/[Packsize UOM]

4:show expression total

regards

Pradosh

Learning never stops.
ranibosch
Creator
Creator
Author

Hi Pradosh,

I want to use a chart as I'm doing sales trending.. ZAR values  vs  Total Tonnage  vs  Total Units

See screenshot of my charts. I'm basically looking to create the 3rd total units chart.

Current formula in these charts are basically:

sum( { < [Trending Value] = {"MP"} > }[Invoiced Quantity])

trending charts.JPG

pradosh_thakur
Master II
Master II

May be this


sum(aggr(sum([Invoice qty])/[Packsize UOM],[Item no]))

Learning never stops.
ranibosch
Creator
Creator
Author

How do I add my set  analysis in this for the MACHINE PACK, HAND PACK etc??

currently the formula looks as follows:

sum( { < [Trending Value] = {"MP"} > }[Invoiced Quantity])

prma7799
Master III
Master III

try like this

sum( { < [Trending Value] = {'MP','HP'} > }[Invoiced Quantity])


or 

sum( { < [Trending Value] = {"MP"} , YourField = {"HP"} > }[Invoiced Quantity])



pradosh_thakur
Master II
Master II

Hi Rani

i guess above is the solution by MP  but you should consider reading this once as it may appear as a bug in future

Quotes in Set Analysis

double quotes are case insensitive so make sure what you use is right for your requirement?

did we answer your question.

Learning never stops.
ranibosch
Creator
Creator
Author

Hi pradosh,

I'm really new a qlikview and need you guys to dumb it down for me..

I need my chart to do the above calculation for me, and then furthermore need to do it for machine packed vs hand packed items.

the packing method is item no specific.

ranibosch
Creator
Creator
Author

I've tried the following code, but it is not working:

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

prma7799
Master III
Master III

Try like this

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