Home Group By - Using Absolute Values
Reply: 0

Group By - Using Absolute Values

user1304
1#
user1304 Published in April 25, 2018, 12:43 am

I'm trying to display an accounting report where I show total transactions, voids, the transaction fee, and a total amount for each transaction type.

TransactionType  Amount  TransactionCount   TotalAmount
AgentCredit      -$1.00   49                 -$49.00
MailFee          -$1.25   11                 -$13.75
MailFee           $1.25   531                 $663.75
HardCardFee      -$5.00   7                 -$35.00
HardCardFee       $5.00   239                $1,195.00
QuotaHuntFee     -$2.00   1                 -$2.00
QuotaHuntFee      $2.00   202                $404.00

But what I want to display would look like the following:

TransactionType Amount  TransactionCount TotalAmount    TotalTrans Voids
AgentCredit    -$1.00    49               -$49.00         49         0
MailFee         $1.25    520               $650.00        531        11
HardCardFee     $5.00    232               $1,160.00      239        7
QuotaHuntFee    $2.00    201               $402.00        202        1

Would it be possible to group the transaction types using the absolute value of the Amount and calculate the grand total along with the transaction count & void counts?

This is on SQL Server 2014.

Thanks,

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300939 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO