Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
qlik4asif
Creator III
Creator III

Sum w.r.t Dimension

Hello Guys

I tried to do sum w.r.t dimension, but i am not able to get it

Can someone help me out.

T1:
Load * INline [
MAT_Num,MAT,Stock
320,H320,100
320,X320,120
320,U320,90
320,S320,130
240,H240,110
240,S240,130
240,U240,100
240,X240,140
];

 

Output:

 

 

 

sample.PNG

I need All 320 Materials with 440 and 240 with 480

 

Thanks in Advance

 
Labels (1)
2 Solutions

Accepted Solutions
tresesco
MVP
MVP

Try:

Sum(total <MAT_Num> Stock)    // however, this would require the MAT_Num dimension to be there in the chart

However, for some reason if you want to stick to aggr(), then try:

Sum(Aggr(NODISTINCT Sum( Stock),MAT_Num))

 

Note: Expression without aggr() would a better performing one.

View solution in original post

qlik4asif
Creator III
Creator III
Author

Thank you Tresesco .

It is working fine for the sample which i have give,

But when i tried to implement the same in my actual application, it is not working.

Could you please elaborate the significance of NODISTINCT in the expression.

 

 

View solution in original post

3 Replies
tresesco
MVP
MVP

Try:

Sum(total <MAT_Num> Stock)    // however, this would require the MAT_Num dimension to be there in the chart

However, for some reason if you want to stick to aggr(), then try:

Sum(Aggr(NODISTINCT Sum( Stock),MAT_Num))

 

Note: Expression without aggr() would a better performing one.

qlik4asif
Creator III
Creator III
Author

Thank you Tresesco .

It is working fine for the sample which i have give,

But when i tried to implement the same in my actual application, it is not working.

Could you please elaborate the significance of NODISTINCT in the expression.

 

 

tresesco
MVP
MVP

Aggr tends to put a value for unique combination of dimension POV (point-of-view), i.e. - it populates only the first POV (dimension combination) value and put null for rest. One nice example here: https://community.qlik.com/t5/QlikView-App-Development/What-NODISTINCT-parameter-does-in-AGGR-functi...