Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
phongnnguyen
Contributor II
Contributor II

Sum total absolute value

Hi everyone,
I have a problem when I calculate sum total of my data. I want to take fabs for each row before sum total

Like my example: x=-1,2,-3,4,-5 (each element is value of each day )
I want sum total= fabs(-1)+fabs(2) + ...+ fabs(-5)
My expectation = 15

Thanks for your help

4 Replies
Frank_Hartmann
Master II
Master II

Where do you want to show this value? In a textbox?

Load *, Fabs(X) as Fabs;
Load * inline [
	Date,  X
	01/01/2018, -1
	02/01/2018, 2
	03/01/2018, -3
	04/01/2018, 4
	05/01/2018, -5
];

 And in Textobject use this to get TOTAL of 15:

sum(TOTAL Fabs)
or
sum(TOTAL Fabs(X))

 

phongnnguyen
Contributor II
Contributor II
Author

Thanks for your help, actually i use it for textbox. But do you have other way to solve by expression , not using load data ?
bharatchauhan
Contributor II
Contributor II

You can you use the following expression:
=SUM(FABS(x))
Hope this help you.
Frank_Hartmann
Master II
Master II

sum(TOTAL Fabs(X))
or
sum(Fabs(X))