Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
What function i can use for Sum + Condition
Exemple
A B C Total Total(only >10)
10 20 20 50 40
I'm searching for function and Set Analysis tutorial.
TNKs
You could embed an if() in a sum() function, for example if you have a field A with values
LOAD * INLINE [
A
10
20
20
];
the expression would look like
=sum( if(A>10, A))
(read as sum of A values if value > 10)
Using Set Analysis it could be something like
=sum({<A= {">10"}>} A)
Or do you have three different fields A,B,C you want to add, but only operands larger than 10? Do you want to create a new field in the script or creating a total value in the front end? The solution could probably look pretty similar to above, in the script, you can't use set analysis, but you could create a new field and use the if() function, maybe like
LOAD A,B,C,
rangesum(If(A>10,A), if(B>10,B), if(C>10,C) ) as Total
FROM ....
Hope this helps,
Stefan
TNX !!
rangesum(If(A>10,A), if(B>10,B), if(C>10,C) )
Perfect