in my report I insert a total textbox (in footer band) which contains this code:
{Sum(Switch(SourceData1.NAME != "" & SourceData1.NAME1== "" & SourceData1.NAME2 == "",SourceData1.AMOUNT,
SourceData1.NAME != "" & SourceData1.NAME1 != "" & SourceData1.NAME2 == "",SourceData1.AMOUNT/2,
SourceData1.NAME != "" & SourceData1.NAME1 != "" & SourceData1.NAME2 != "",SourceData1.AMOUNT/3))}
(the code Sum the division the amount by the number of users. If they are two users, divide by two, if they are three users, divide by three, if only one user does not divide).
But the result of the sum is often not good.
Why this ?
Is there another way to make this sum ?
Many Thanks for help
strange behavior of the sum function
Re: strange behavior of the sum function
Hi Mirmidone,
Please try to use Calculated Columns to calculate the values per row, and then you could get a sum of them.
https://www.youtube.com/watch?v=9yN3IRTP_aI
In this case, in the report, you will be able to see the problem with calculation, if any. Also please check that SourceData1.AMOUNT is not equals DBNull.Value, in that case, you could use something like that:
Thank you,
Edward
Please try to use Calculated Columns to calculate the values per row, and then you could get a sum of them.
https://www.youtube.com/watch?v=9yN3IRTP_aI
In this case, in the report, you will be able to see the problem with calculation, if any. Also please check that SourceData1.AMOUNT is not equals DBNull.Value, in that case, you could use something like that:
Code: Select all
SourceData1["AMOUNT"] is DBNull ? 0 : SourceData1.AMOUNT
Edward