Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I was recently given this awesome expression to sum Amounts for a value if it was present in either Field1 or Field2:
if(GetSelectedCount(Field1), sum({<Field1=p(Field1),Field2=>+<Field2=p(Field1),Field1=>}Amounts),
if(GetSelectedCount(Field2), sum({<Field2=p(Field2),Field1=>+<Field1=p(Field2),Field2=>}Amounts),sum(Amounts)))
However, I would like to create some variations on this. How do I write an expression that does the following:
- sum when the selected value is ONLY in Field1;
- sum when the selected value is ONLY in Field2;
- sum ONLY when the selected value is BOTH in Field1 and Field2.
Does anyone know how I can do this?
You might be able to achieve this by changing the + sign (union) to * for intersection (BOTH) and - for exclude, like this:
<Field1=p(Field1),Field2=>-<Field2=p(Field1),Field1=>
<Field2=p(Field2),Field1=>-<Field1=p(Field2),Field2=>
<Field2=p(Field2),Field1=>*<Field1=p(Field2),Field2=>
HTH
Jonathan
You might be able to achieve this by changing the + sign (union) to * for intersection (BOTH) and - for exclude, like this:
<Field1=p(Field1),Field2=>-<Field2=p(Field1),Field1=>
<Field2=p(Field2),Field1=>-<Field1=p(Field2),Field2=>
<Field2=p(Field2),Field1=>*<Field1=p(Field2),Field2=>
HTH
Jonathan
It worked. Thank you!