Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a question concerning a sum.
I have two columns :
The first column is the state (input/output)
The second is a value.
I want to make the sum of these values : when the value is an input I add the value to the sum and when the value is an output, I remove this value to the sum.
I know that it is an expression in my graph, but I don't know how to do that......
Thanks for your help
Annie
Hi Annie,
I would suggest creating a flag in your script for the state that is either 1 or -1:
If(State='input',1,-1) as StateFlag
Then you can use this in your calculation:
Value * StateFlag
Hi Annie,
I would suggest creating a flag in your script for the state that is either 1 or -1:
If(State='input',1,-1) as StateFlag
Then you can use this in your calculation:
Value * StateFlag
Hi Annie,
let's assume you have a chart with an expression to sum up a field called Val. And there is another Field called State with two values as described above. Then try to filter the sum similar to this:
Sum( If(State = 'Input', Val, 0) )
or, may be you like below :
Sum( If State = 'Input', Val, Val*-1))
HtH
Roland
Thank youn Jphannes, you made my day 😃