Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

really damn problem with manual summing

$
0
0

Hi all, 

ok i have a really have a problem with a report which is hard to explain, cause the report isnt standard and easy (i think).

I have a a manual sum function, cause (i think) the normal sum wont work.

Everytime the first (in screenshot green marked) sum is summed twice, what is wrong.

I cant use the standard sum function for groups. because of the yellow marked rows i cant sum, cause from the yellow rows i only need the min().

The second reason, because i need the sum manual (function) is..

The left col und the right col need to build a diffence (green marked) not a sum.

The blue marked total is wrong by 500€ which results through the 2 times summed first row in the group.

btw: 
the reason for the problem is not the row per se. Because if i change the sorting in the group, so the green marked group with 500€ is not the first row in the group, it is summed correct.

But an other row, which is the first in the group now, f.e. the 1200€ row is now summed twice.

So the problem need to be searched in the first row in the group.

But i cant see the problem?!

the custom code with the manual sum creation is:

Public dim summe as Decimal = 0

Public function AddSum(sum as Decimal) as Decimal
summe = summe + sum
return sum
end function

Public function PrintSum()
return summe
end function

---

.. and i do the summing in the green marked field:

=Code.AddSum(
iif(sum(iif(Fields!va.Value = "Angebot", Fields!jb.Value, nothing))=0,
cdbl(0), 
Min(iif(Fields!va.Value = "Angebot", Fields!jb.Value, nothing)) - sum(iif(Fields!va.Value = "Vertrag", Fields!jb.Value, nothing))
)
)

and in the blue marked total sum i only have:

=Code.PrintSum()

---

i do the sum calculation of the groupsum not with the normal sum() funktion.

I do it in the Group-field (blue 3596,00 €) with:

=iif(Fields!va.Value = "Angebot", 
iif(sum(iif(Fields!va.Value = "Angebot", Fields!jb.Value, nothing))=0,
cdbl(0),
Min(Fields!jb.Value)),
sum(iif(Fields!va.Value = "Vertrag", cdbl(Fields!jb.Value), nothing))
)

----

fyi: I have no filter or visibility settings in group or rows.

THX 4 any helf
Greets Pit



Viewing all articles
Browse latest Browse all 28687

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>