Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis - Basic BODMAS

Hi All

i wanted to divide X by Y first for Sales ID,Answer Z , so i want the aggregation of Z

E .g

xyZ
1052
2045
Answer7
1 Solution

Accepted Solutions
avinashelite

Try like this

sum([Full Pack]/[Pack])...this will give u the result

New sum.png

View solution in original post

11 Replies
avinashelite

Hi Jayanth,

Please use AGGR(x/y,Z) .... in the expression total select sum .

Aggr.png

Hope this is what ur looking for.

Not applicable
Author

Hi

could you please verify the below expression  is correct

=Aggr((sum(if([SHIPPED QTY]>0 and [QTY VARIANCE]<0,[QTY VARIANCE],'0')))*-1)*(sum([FULL FOB])/sum(PACK))

Not applicable
Author

where

FULL FOB = X

PACK    = Y

Not applicable
Author

you missed dimension in aggr() function

=Aggr((sum(if([SHIPPED QTY]>0 and [QTY VARIANCE]<0,[QTY VARIANCE],'0')))*-1,DIMENSION)*(sum([FULL FOB])/sum(PACK))

use your respective dimension name instead of dimension

avinashelite

Try like this

Aggr(if([SHIPPED QTY]>0 and [QTY VARIANCE]<0,sum([QTY VARIANCE],0)*(sum([FULL FOB])/sum(PACK)),Z)

Where Z is the field on which you need to do the aggregation.

Anonymous
Not applicable
Author

Your expression should be,

Sum( Aggr( Sum( x )/Sum( y ), dimension ) )

Anonymous
Not applicable
Author

Hi,

You need to add dimension in aggregation and finally enclose with sum function.

=Sum(Aggr((sum(if([SHIPPED QTY]>0 and [QTY VARIANCE]<0,[QTY VARIANCE],'0')))*-1)*(sum([FULL FOB])/sum(PACK), Dimension))

Not applicable
Author

hi both

thank you for the support

But i have little messed up with this . i wanted to divide Full Pack (X) by Pack(Y) and then add them .

E.g

X =10,20

Y = 5,10

so what i want  is(10/5) +(20/10)= 4

whereas my script reads them as (10+20) /(5+10)=2 which is incorrect

Sorry for the inconvenience caused

avinashelite

Try like this

sum([Full Pack]/[Pack])...this will give u the result

New sum.png