Sum Function
Sum Function
I have a dataset like this:
Claim # - Contact - Claim Total Paid
1 -- Joe -- $1500
1 -- Jerry -- $1500
1 -- Harry -- $1500
1 -- Nancy -- $1500
TOTAL $6000
So the Claim Total Paid is repeated for each of the Contacts. That means when we try to total the Paid column, it shows 4x the actual total. We just need the one amount to total for each claim number, in this case it should be $1500. Any ideas on how to resolve this?
Claim # - Contact - Claim Total Paid
1 -- Joe -- $1500
1 -- Jerry -- $1500
1 -- Harry -- $1500
1 -- Nancy -- $1500
TOTAL $6000
So the Claim Total Paid is repeated for each of the Contacts. That means when we try to total the Paid column, it shows 4x the actual total. We just need the one amount to total for each claim number, in this case it should be $1500. Any ideas on how to resolve this?
Sum Function
Hello,
If we understand you correctly you want to count the distinct values. Standard feature in the designer there, but you can implement it yourself using the following code:
Please see the sample report in attachment.
Thank you.
If we understand you correctly you want to count the distinct values. Standard feature in the designer there, but you can implement it yourself using the following code:
Code: Select all
private Hashtable hTable = new Hashtable();
private int sumDistinct = 0;
private int indexKey = 0;
public int SumDistinct(int addValue)
{
if (!hTable.ContainsValue(addValue))
{
sumDistinct = sumDistinct + addValue;
hTable.Add(indexKey, addValue);
indexKey ++;
}
return addValue;
}
Thank you.
- Attachments
-
- 600.SumDistinct.mrt
- (22.97 KiB) Downloaded 586 times
Sum Function
Aleksey wrote:Hello,
If we understand you correctly you want to count the distinct values. Standard feature in the designer there, but you can implement it yourself using the following code:Please see the sample report in attachment.Code: Select all
private Hashtable hTable = new Hashtable(); private int sumDistinct = 0; private int indexKey = 0; public int SumDistinct(int addValue) { if (!hTable.ContainsValue(addValue)) { sumDistinct = sumDistinct + addValue; hTable.Add(indexKey, addValue); indexKey ++; } return addValue; }
Thank you.
The issue is actually a little more complex. Expanding on my example:
Claim # Contact Claim Total Paid
1 Joe $1500
1 Jerry $1500
1 Harry $1500
1 Nancy $1500
CLAIM TOTAL $1500 (Subtotal 1)
2 John $2000
2 Hank $2000
CLAIM TOTAL $2000 (Subtotal 2)
3 Jimmy $1500
CLAIM TOTAL $1500 (Subtotal 3)
GRAND TOTAL $5000 (Sum of Subtotal 1, 2 & 3)
I can make each Claim (1, 2 & 3) total correctly, but what I can’t do is calculate the GRAND TOTAL amount. A ‘sum distinct’ function won’t work because 2 Claims may have the same Total Paid amount.
Sum Function
Hello,
that is my talk... I thing, that SumDistinct is usable in more complex cases than this workaround makes possible... I thing, better will be to implement this function into base Stimulsoft functions... This example didn't help even me ...
Thank you...
that is my talk... I thing, that SumDistinct is usable in more complex cases than this workaround makes possible... I thing, better will be to implement this function into base Stimulsoft functions... This example didn't help even me ...
Thank you...
Sum Function
Hello,
Function SumDistinct() will be added in designer. Solution will be available in relise on end of september.
Thank you.
Function SumDistinct() will be added in designer. Solution will be available in relise on end of september.
Thank you.
Sum Function
Aleksey, great news
We are looking forward to the release.
Thank you very much!

Thank you very much!
Sum Function
We are always glad to help you!
Sum Function
I don’t believe ‘Sum Distinct’ will work for our problem. We don’t want to count ‘distinct’ values (see example, where Subtotal 1 & SubTotal 3 are identical, but must be added separately).
We need to be able to total the Subtotals (1, 2 & 3).
We need to be able to total the Subtotals (1, 2 & 3).
Sum Function
Hello,
Please see the sample report in attachment.
Thank you.
Please see the sample report in attachment.
Thank you.
- Attachments
-
- 602.Sample Report.zip
- (2.68 KiB) Downloaded 526 times
-
- Posts: 16
- Joined: Mon Oct 11, 2010 9:43 am
Sum Function
I have a very similar problem with a report. I can't get your sample report to work because the dataset seems to be incorrect or not lined up, but I don't understand where SumDistinct comes from or if it does what I want it to do. The same with GrandTotal. How can I get this report to work to see if it's doing what I need it to do- and where does SumDistinct get called from- and how do I call it on the right data?