Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone,
I have to perform a sum based on following conditions:
First result should come from first condition as:
(refcode -= NULL)
and add the above result to result from this second condition:
refcode = NULL AND (refnum_in1 -= NULL OR refnum_in2 -= NULL)
All the three are columns of same table.
Please help.
Hi!
According to example table provided by @y_grynechko + Sales field as measure, try something like this:
Sum({<refcode= {"*"} Sales) // refcode-= NULL
+
// and add the above result to result from this second condition:
// refcode = NULL AND (refnum_in1 -= NULL OR refnum_in2 -= NULL)
Sum({<ID={"=Len(refcode)=0"}, refnum_in1={"*"}>} Sales) + Sum({<ID={"=Len(refcode)=0"}, refnum_in2={"*"}>} Sales)
Best Regards
Hey,
I am not sure what are you asking for.
For example if your table looks like this:
what do you want to accomplish?
Hi!
According to example table provided by @y_grynechko + Sales field as measure, try something like this:
Sum({<refcode= {"*"} Sales) // refcode-= NULL
+
// and add the above result to result from this second condition:
// refcode = NULL AND (refnum_in1 -= NULL OR refnum_in2 -= NULL)
Sum({<ID={"=Len(refcode)=0"}, refnum_in1={"*"}>} Sales) + Sum({<ID={"=Len(refcode)=0"}, refnum_in2={"*"}>} Sales)
Best Regards
The code should first check the refcode column. If there are no nulls then those charges will be picked up to sum, then if it is null it will goto refnum_in1 and repeat same and add those charges to the cumulative sum of charges picked up by refcode. If both refcode and refnum_in1 are found to be null then refnum_in2 is checked and if value exists then its corresponding charge is picked up to add to the charges picked up by first two.
Note: The priority of code should flow from refcode to refnum_in2.