Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
torpe999
Contributor II
Contributor II

how to sum calculated absolute values

Hello,

I am trying to sum calculated absolute values but not successfully.  I need to calculate total demand accuracy which is

= ( 1- sum (calculated absolute gap deviation)/ sum(planned volume) 

but when I try to sum calculated absolute gap deviation, i get sum of gap deviation but not sum of absolute gap deviation though in the table total field it's shown correctly. What should i do in order to sum absolute values and get correct total demand accuracy?

Produkto Nr.Parduota (sold)litruSuplanuota (planned)litruabs gap devgap dev
 40 320253001574015020
S001328 6409000360-360
S053015 760430014601460
S0530325 920120001392013920

 

Total demand accuracy
0,406324111

 

and it should be:  should be 1-(15740/25300)=0,377

1 Solution

Accepted Solutions
chrismarlow
Specialist II
Specialist II

Hi,

You need to use AGGR wrapped around the bit you taking the absolute value to make it apply to each row, even in the total, so I think something like this will work, but will depend on how your totals have come together;

1-(sum(aggr(fabs(sum([Parduota (sold)litru])-sum([Suplanuota (planned)litru])),[Produkto Nr.]))/sum([Suplanuota (planned)litru]))

20190610_1.png

Cheers,

Chris.

View solution in original post

2 Replies
chrismarlow
Specialist II
Specialist II

Hi,

You need to use AGGR wrapped around the bit you taking the absolute value to make it apply to each row, even in the total, so I think something like this will work, but will depend on how your totals have come together;

1-(sum(aggr(fabs(sum([Parduota (sold)litru])-sum([Suplanuota (planned)litru])),[Produkto Nr.]))/sum([Suplanuota (planned)litru]))

20190610_1.png

Cheers,

Chris.

torpe999
Contributor II
Contributor II
Author

great, thanks! It worked!