Quantcast
Channel: SQL Server Reporting Services, Power View 포럼
Viewing all articles
Browse latest Browse all 24955

Sum of Sums or Aggregation question in SQL Server 2012

$
0
0

I've read maybe a dozen posts with like issues but can't help believing there is a really simple solution to my problem, which is shown in the example below. The Invoice_Total Sum at the table1_Customer group level showing $30 is incorrect. The correct value is $10 since there is just the single invoice #1 in the table.

The SUM function is looking at all the bottom level group rows and assuming $10 for each of them (even though their Invoice_Total cells are blank). I would like it to sum only the table1_Invoice rows (only 1 row shown in this simple example).

Is there not some simple SUM expression that will aim the addition at only the immediate child group instead?

Row Groups           Customer  Invoice#   Invoice_Total    Item_Name    Item_Class

table1_Customer   Smith                          $30

table1_Invoice                             1            $10

table1_Item                                                                              A              Domestic

table1_Item                                                                              B               Import

table1_Item                                                                              C               Mars


HomeCookN



Viewing all articles
Browse latest Browse all 24955

Trending Articles



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