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

T-SQL / SUM() OVER PARTITION differences

$
0
0

Hello there,

spends 3 days of my life and to ask here seems to be my last chance.

I created an invoice (DECIMAL(10,2) on every stage)
for our company that should be used to pay the employees. I am working with:

- SQL Server 2008R2
- MS Reporting Services

I know that I could use subtotals or subreports,
but the style and body they wanted is really crazy.

So for my subtotals I went with

SUM(workingtime) OVER (PARTITION BY Week, Type_of_work) * (Amount_per_type_of_work)

It worked fine, but I had to make an seperate "Invoice Attachment" where I had to split
the amount of money to

SUM(workingtime) OVER (PARTITION BY Week, Type_of_work, Departments) * (Amount_per_type_of_work)

And that's where it was over...in some weeks I have got 1 Cent difference between
the original "Invoice and Invoice Attachment".

For my understanding I should get with every SUM OVER PARTITION at least the same
sum at the end.


Viewing all articles
Browse latest Browse all 10045

Trending Articles



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