Thursday, October 30, 2014

General Ledger Transactions and Line Totals per Day

Recently I answered a forum post by a user who wanted to know the number of transactions by module in a given day.  I authored a series of queries which allow a user to input a date and execute the query. 

The queries identify the number of unique transactions and the number of lines in the table. Dividing one by the other will reveal the average lines per transaction.  

This query reveals the Number of General Ledger Journal Entries on a given day and the number of overall lines.

DECLARE @Date as DATETIME
SET @Date = '04/12/2017'

/*Journal Entries*/
select sum(a.Journal_Entries) GL_Transactions from (
select count(c.GL_Transactions) Journal_Entries from (Select COUNT(jrnentry) GL_Transactions FROM GL20000 where TRXDATE = @Date group by JRNENTRY) c
Union All
select count(c.GL_Transactions) Journal_Entries from (Select COUNT(jrnentry) GL_Transactions FROM GL30000 where TRXDATE = @Date group by JRNENTRY) c ) a
/*GL Transaction Lines*/
select SUM(a.GL_Trx_Lines) GL_Trx_Lines from (
Select count(JRNENTRY) GL_Trx_Lines FROM GL20000 where TRXDATE = @Date group by TRXDATE
Union All

Select count(JRNENTRY) GL_Trx_Lines FROM GL30000 where TRXDATE = @Date group by TRXDATE) a

No comments:

Post a Comment