I have a Crystal Report which uses data from a Data Table.
I have grouping and calculating sum within the groups. The grouping is by the field vid.
I want to perform calculation where if vid="Pri" the field izn of that row should be summarized, and if vid="Isp" then the field izn should be summarized and then subtracted from the first sum (when vid=Pri).
For the first sum (if vid="Pri") the calculation is ok (for the group with vid="Pri"), but if vid="Isp", (for the group with vid="Isp"), the result of the sum function is always 0, i.e. it doesn't calculate correctly. So I can not perform the last calculation (summarize when vid is Pri and subtract the sum, when vid=Isp).
The first formula which calculates correctly is:
if({DataTable3.vid}="Pri") then Sum ({DataTable3.Iznos}, {DataTable3.vid})
and the formula for the other sum, when vid=Isp is
if({DataTable3.vid}="Isp") then Sum ({DataTable3.Iznos}, {DataTable3.vid})
Can anybody help me please what is the mistake I make in the bold line for having the result 0, instead of the correct result?
Below is the image of the report
Thank you in advance

Replies
Know the answer? Post it — somebody with the same question will find it here.