Logo

RunningCOUNT

Updated 2023-11-14 14:32:04.087000

Syntax

SELECT [westclintech].[wct].[RunningCOUNT](
  <@Val, sql_variant,>
 ,<@RowNum, int,>
 ,<@Id, tinyint,>
 ,<@CountNulls, bit,>)

Description

Use the scalar function to show how many rows are included in an ordered resultant table or within a partition in the resultant table, without having to do a self-join. The count is calculated over all the values from the first value to the last value in the ordered group or partition. If the column values are presented to the functions out of order, an error message will be generated.

Arguments

@CountNulls

Indicates whether NULL values are included in the count. Enter 'True' to count NULL or 'False' not to count NULL. @CountNulls is an expression of type bit or of a type that can be implicitly converted to bit.

@Id

a unique identifier for the RunningCOUNT calculation. @Id allows you to specify multiple RunningCOUNT calculation s within a resultant table. @Id is an expression of type tinyint or of a type that can be implicitly converted to tinyint.

@RowNum

the number of the row within the group for which the sum is being calculated. If @RowNum for the current row in a set is less than or equal to the previous @RowNum and @RowNum is not equal to 1, an error message will be generated. @RowNum is an expression of type int or of a type that can be implicitly converted to int.

@Val

the value passed into the function. @Val is an expression of type float or of a type that can be implicitly converted to float.

Return Type

float

Remarks

If @Id is NULL then @Id = 0.

To calculate moving count, use the MovingCOUNT function.

@RowNum must be in ascending order.

There may be cases where the order in which the data are returned to the function and the order in which the results are returned are different, generally due to parallelism. You can use OPTION(MAXDOP 1) or OPTION(MAXDOP 1,FORCE ORDER) to help eliminate this problem.

Examples

In this example we will calculate the running count of items for a check book. We will create a temporary table, #c, populate it with some data and then run the SELECT.

--Create the temporary table

CREATE TABLE #c

(

    trn int,

    cust_ref varchar(5),

    date_trn datetime,

    payee varchar(20),

    amt_trn money,

    PRIMARY KEY (trn)

);

--Populate the table with some data

INSERT INTO #c

VALUES

(1, 'DD', '2011-12-23', NULL, 1500);

INSERT INTO #c

VALUES

(2, '1200', '2012-01-01', 'Car Leasing Company', -361.75);

INSERT INTO #c

VALUES

(3, '1201', '2012-01-01', 'Mortgage Bank', -1129.23);

INSERT INTO #c

VALUES

(4, 'DD', '2012-01-08', NULL, 1100);

INSERT INTO #c

VALUES

(5, '1202', '2012-01-15', 'Gas Company', -108.49);

INSERT INTO #c

VALUES

(6, '1203', '2012-01-15', 'Electric Company', -98.27);

INSERT INTO #c

VALUES

(7, '1204', '2012-01-15', 'Telephone Company', -136.6);

INSERT INTO #c

VALUES

(8, 'DD', '2012-02-15', NULL, 1100);

INSERT INTO #c

VALUES

(9, '1205', '2012-02-01', 'Car Leasing Company', -361.75);

INSERT INTO #c

VALUES

(10, '1206', '2012-02-01', 'Mortgage Bank', -1129.23);

INSERT INTO #c

VALUES

(11, 'DD', '2012-02-08', NULL, 1100);

INSERT INTO #c

VALUES

(12, '1207', '2012-02-15', 'Gas Company', -153.89);

INSERT INTO #c

VALUES

(13, '1208', '2012-02-15', 'Electric Company', -121.99);

INSERT INTO #c

VALUES

(14, '1209', '2012-02-15', 'Telephone Company', -138.92);

INSERT INTO #c

VALUES

(15, 'DD', '2012-02-23', NULL, 1100);

INSERT INTO #c

VALUES

(16, '1210', '2012-03-01', 'Car Leasing Company', -361.75);

INSERT INTO #c

VALUES

(17, '1211', '2012-03-01', 'Mortgage Bank', -1129.23);

INSERT INTO #c

VALUES

(18, 'DD', '2012-03-08', NULL, 1100);

INSERT INTO #c

VALUES

(19, '1212', '2012-03-15', 'Gas Company', -70.79);

INSERT INTO #c

VALUES

(20, '1213', '2012-03-15', 'Electric Company', -93.57);

INSERT INTO #c

VALUES

(21, '1214', '2012-03-15', 'Telephone Company', -149.78);

INSERT INTO #c

VALUES

(22, 'DD', '2012-03-23', NULL, 1100);

INSERT INTO #c

VALUES

(23, '1215', '2012-04-01', 'Car Leasing Company', -361.75);

INSERT INTO #c

VALUES

(24, '1216', '2012-04-01', 'Mortgage Bank', -1129.23);

INSERT INTO #c

VALUES

(25, 'DD', '2012-04-08', NULL, 1100);

INSERT INTO #c

VALUES

(26, '1217', '2012-04-15', 'Gas Company', -105.58);

INSERT INTO #c

VALUES

(27, '1218', '2012-04-15', 'Electric Company', -149.36);

INSERT INTO #c

VALUES

(28, '1219', '2012-04-15', 'Telephone Company', -145.35);

INSERT INTO #c

VALUES

(29, 'DD', '2012-04-23', NULL, 1100);

INSERT INTO #c

VALUES

(30, '1220', '2012-05-01', 'Car Leasing Company', -361.75);

INSERT INTO #c

VALUES

(31, '1221', '2012-05-01', 'Mortgage Bank', -1129.23);

INSERT INTO #c

VALUES

(32, 'DD', '2012-05-08', NULL, 1100);

INSERT INTO #c

VALUES

(33, '1222', '2012-05-15', 'Gas Company', -96.27);

INSERT INTO #c

VALUES

(34, '1223', '2012-05-15', 'Electric Company', -114.62);

INSERT INTO #c

VALUES

(35, '1224', '2012-05-15', 'Telephone Company', -145.43);

INSERT INTO #c

VALUES

(36, 'DD', '2012-05-23', NULL, 1100);

INSERT INTO #c

VALUES

(37, '1225', '2012-06-01', 'Car Leasing Company', -361.75);

INSERT INTO #c

VALUES

(38, '1226', '2012-06-01', 'Mortgage Bank', -1129.23);

INSERT INTO #c

VALUES

(39, 'DD', '2012-06-08', NULL, 1100);

INSERT INTO #c

VALUES

(40, '1227', '2012-06-15', 'Gas Company', -147.03);

INSERT INTO #c

VALUES

(41, '1228', '2012-06-15', 'Electric Company', -130.52);

INSERT INTO #c

VALUES

(42, '1229', '2012-06-15', 'Telephone Company', -147.71);

INSERT INTO #c

VALUES

(43, 'DD', '2012-06-23', NULL, 1100);

INSERT INTO #c

VALUES

(44, '1230', '2012-07-01', 'Car Leasing Company', -361.75);

INSERT INTO #c

VALUES

(45, '1231', '2012-07-01', 'Mortgage Bank', -1129.23);

INSERT INTO #c

VALUES

(46, 'DD', '2012-07-08', NULL, 1100);

--Calculate the running COUNT

SELECT cast(convert(varchar, date_trn, 106) as char(11)) as date_trn,

       cust_ref,

       payee,

       amt_trn,

       wct.RunningCOUNT(amt_trn, trn, NULL, NULL) as [Running Count]

FROM #c;

--Clean up

DROP TABLE #c;

This produces the following result.

{"columns":[{"field":"date_trn","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cust_ref"},{"field":"payee"},{"field":"amt_trn","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Running Total","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_trn":"23 Dec 2011","cust_ref":"DD","payee":"NULL","amt_trn":"1500.00","Running Total":"1"},{"date_trn":"01 Jan 2012","cust_ref":"1200","payee":"Car Leasing Company","amt_trn":"-361.75","Running Total":"2"},{"date_trn":"01 Jan 2012","cust_ref":"1201","payee":"Mortgage Bank","amt_trn":"-1129.23","Running Total":"3"},{"date_trn":"08 Jan 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"4"},{"date_trn":"15 Jan 2012","cust_ref":"1202","payee":"Gas Company","amt_trn":"-108.49","Running Total":"5"},{"date_trn":"15 Jan 2012","cust_ref":"1203","payee":"Electric Company","amt_trn":"-98.27","Running Total":"6"},{"date_trn":"15 Jan 2012","cust_ref":"1204","payee":"Telephone Company","amt_trn":"-136.60","Running Total":"7"},{"date_trn":"15 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"8"},{"date_trn":"01 Feb 2012","cust_ref":"1205","payee":"Car Leasing Company","amt_trn":"-361.75","Running Total":"9"},{"date_trn":"01 Feb 2012","cust_ref":"1206","payee":"Mortgage Bank","amt_trn":"-1129.23","Running Total":"10"},{"date_trn":"08 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"11"},{"date_trn":"15 Feb 2012","cust_ref":"1207","payee":"Gas Company","amt_trn":"-153.89","Running Total":"12"},{"date_trn":"15 Feb 2012","cust_ref":"1208","payee":"Electric Company","amt_trn":"-121.99","Running Total":"13"},{"date_trn":"15 Feb 2012","cust_ref":"1209","payee":"Telephone Company","amt_trn":"-138.92","Running Total":"14"},{"date_trn":"23 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"15"},{"date_trn":"01 Mar 2012","cust_ref":"1210","payee":"Car Leasing Company","amt_trn":"-361.75","Running Total":"16"},{"date_trn":"01 Mar 2012","cust_ref":"1211","payee":"Mortgage Bank","amt_trn":"-1129.23","Running Total":"17"},{"date_trn":"08 Mar 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"18"},{"date_trn":"15 Mar 2012","cust_ref":"1212","payee":"Gas Company","amt_trn":"-70.79","Running Total":"19"},{"date_trn":"15 Mar 2012","cust_ref":"1213","payee":"Electric Company","amt_trn":"-93.57","Running Total":"20"},{"date_trn":"15 Mar 2012","cust_ref":"1214","payee":"Telephone Company","amt_trn":"-149.78","Running Total":"21"},{"date_trn":"23 Mar 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"22"},{"date_trn":"01 Apr 2012","cust_ref":"1215","payee":"Car Leasing Company","amt_trn":"-361.75","Running Total":"23"},{"date_trn":"01 Apr 2012","cust_ref":"1216","payee":"Mortgage Bank","amt_trn":"-1129.23","Running Total":"24"},{"date_trn":"08 Apr 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"25"},{"date_trn":"15 Apr 2012","cust_ref":"1217","payee":"Gas Company","amt_trn":"-105.58","Running Total":"26"},{"date_trn":"15 Apr 2012","cust_ref":"1218","payee":"Electric Company","amt_trn":"-149.36","Running Total":"27"},{"date_trn":"15 Apr 2012","cust_ref":"1219","payee":"Telephone Company","amt_trn":"-145.35","Running Total":"28"},{"date_trn":"23 Apr 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"29"},{"date_trn":"01 May 2012","cust_ref":"1220","payee":"Car Leasing Company","amt_trn":"-361.75","Running Total":"30"},{"date_trn":"01 May 2012","cust_ref":"1221","payee":"Mortgage Bank","amt_trn":"-1129.23","Running Total":"31"},{"date_trn":"08 May 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"32"},{"date_trn":"15 May 2012","cust_ref":"1222","payee":"Gas Company","amt_trn":"-96.27","Running Total":"33"},{"date_trn":"15 May 2012","cust_ref":"1223","payee":"Electric Company","amt_trn":"-114.62","Running Total":"34"},{"date_trn":"15 May 2012","cust_ref":"1224","payee":"Telephone Company","amt_trn":"-145.43","Running Total":"35"},{"date_trn":"23 May 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"36"},{"date_trn":"01 Jun 2012","cust_ref":"1225","payee":"Car Leasing Company","amt_trn":"-361.75","Running Total":"37"},{"date_trn":"01 Jun 2012","cust_ref":"1226","payee":"Mortgage Bank","amt_trn":"-1129.23","Running Total":"38"},{"date_trn":"08 Jun 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"39"},{"date_trn":"15 Jun 2012","cust_ref":"1227","payee":"Gas Company","amt_trn":"-147.03","Running Total":"40"},{"date_trn":"15 Jun 2012","cust_ref":"1228","payee":"Electric Company","amt_trn":"-130.52","Running Total":"41"},{"date_trn":"15 Jun 2012","cust_ref":"1229","payee":"Telephone Company","amt_trn":"-147.71","Running Total":"42"},{"date_trn":"23 Jun 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"43"},{"date_trn":"01 Jul 2012","cust_ref":"1230","payee":"Car Leasing Company","amt_trn":"-361.75","Running Total":"44"},{"date_trn":"01 Jul 2012","cust_ref":"1231","payee":"Mortgage Bank","amt_trn":"-1129.23","Running Total":"45"},{"date_trn":"08 Jul 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","Running Total":"46"}]}

In this example, we calculate the running count and the running count for each month and use the ROW_NUMBER() function to determine the @RowNum value passed into the RunningCOUNT function.

SELECT cast(convert(varchar, date_trn, 106) as char(11)) as date_trn,

       cust_ref,

       payee,

       amt_trn,

       wct.RunningCOUNT(amt_trn, ROW_NUMBER() OVER (PARTITION by MONTH(date_trn)

                 ORDER BY trn), 1, NULL) as [MTD Count],

       wct.RunningCOUNT(amt_trn, trn, NULL, NULL) as [Running Count]

FROM #c

ORDER BY trn;

This produces the following result.

{"columns":[{"field":"date_trn","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cust_ref"},{"field":"payee"},{"field":"amt_trn","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"MTD Count","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Running Count","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_trn":"23 Dec 2011","cust_ref":"DD","payee":"NULL","amt_trn":"1500.00","MTD Count":"1","Running Count":"1"},{"date_trn":"01 Jan 2012","cust_ref":"1200","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"2"},{"date_trn":"01 Jan 2012","cust_ref":"1201","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"3"},{"date_trn":"08 Jan 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"3","Running Count":"4"},{"date_trn":"15 Jan 2012","cust_ref":"1202","payee":"Gas Company","amt_trn":"-108.49","MTD Count":"4","Running Count":"5"},{"date_trn":"15 Jan 2012","cust_ref":"1203","payee":"Electric Company","amt_trn":"-98.27","MTD Count":"5","Running Count":"6"},{"date_trn":"15 Jan 2012","cust_ref":"1204","payee":"Telephone Company","amt_trn":"-136.60","MTD Count":"6","Running Count":"7"},{"date_trn":"15 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"1","Running Count":"8"},{"date_trn":"01 Feb 2012","cust_ref":"1205","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"2","Running Count":"9"},{"date_trn":"01 Feb 2012","cust_ref":"1206","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"3","Running Count":"10"},{"date_trn":"08 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"4","Running Count":"11"},{"date_trn":"15 Feb 2012","cust_ref":"1207","payee":"Gas Company","amt_trn":"-153.89","MTD Count":"5","Running Count":"12"},{"date_trn":"15 Feb 2012","cust_ref":"1208","payee":"Electric Company","amt_trn":"-121.99","MTD Count":"6","Running Count":"13"},{"date_trn":"15 Feb 2012","cust_ref":"1209","payee":"Telephone Company","amt_trn":"-138.92","MTD Count":"7","Running Count":"14"},{"date_trn":"23 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"8","Running Count":"15"},{"date_trn":"01 Mar 2012","cust_ref":"1210","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"16"},{"date_trn":"01 Mar 2012","cust_ref":"1211","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"17"},{"date_trn":"08 Mar 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"3","Running Count":"18"},{"date_trn":"15 Mar 2012","cust_ref":"1212","payee":"Gas Company","amt_trn":"-70.79","MTD Count":"4","Running Count":"19"},{"date_trn":"15 Mar 2012","cust_ref":"1213","payee":"Electric Company","amt_trn":"-93.57","MTD Count":"5","Running Count":"20"},{"date_trn":"15 Mar 2012","cust_ref":"1214","payee":"Telephone Company","amt_trn":"-149.78","MTD Count":"6","Running Count":"21"},{"date_trn":"23 Mar 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"7","Running Count":"22"},{"date_trn":"01 Apr 2012","cust_ref":"1215","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"23"},{"date_trn":"01 Apr 2012","cust_ref":"1216","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"24"},{"date_trn":"08 Apr 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"3","Running Count":"25"},{"date_trn":"15 Apr 2012","cust_ref":"1217","payee":"Gas Company","amt_trn":"-105.58","MTD Count":"4","Running Count":"26"},{"date_trn":"15 Apr 2012","cust_ref":"1218","payee":"Electric Company","amt_trn":"-149.36","MTD Count":"5","Running Count":"27"},{"date_trn":"15 Apr 2012","cust_ref":"1219","payee":"Telephone Company","amt_trn":"-145.35","MTD Count":"6","Running Count":"28"},{"date_trn":"23 Apr 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"7","Running Count":"29"},{"date_trn":"01 May 2012","cust_ref":"1220","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"30"},{"date_trn":"01 May 2012","cust_ref":"1221","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"31"},{"date_trn":"08 May 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"3","Running Count":"32"},{"date_trn":"15 May 2012","cust_ref":"1222","payee":"Gas Company","amt_trn":"-96.27","MTD Count":"4","Running Count":"33"},{"date_trn":"15 May 2012","cust_ref":"1223","payee":"Electric Company","amt_trn":"-114.62","MTD Count":"5","Running Count":"34"},{"date_trn":"15 May 2012","cust_ref":"1224","payee":"Telephone Company","amt_trn":"-145.43","MTD Count":"6","Running Count":"35"},{"date_trn":"23 May 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"7","Running Count":"36"},{"date_trn":"01 Jun 2012","cust_ref":"1225","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"37"},{"date_trn":"01 Jun 2012","cust_ref":"1226","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"38"},{"date_trn":"08 Jun 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"3","Running Count":"39"},{"date_trn":"15 Jun 2012","cust_ref":"1227","payee":"Gas Company","amt_trn":"-147.03","MTD Count":"4","Running Count":"40"},{"date_trn":"15 Jun 2012","cust_ref":"1228","payee":"Electric Company","amt_trn":"-130.52","MTD Count":"5","Running Count":"41"},{"date_trn":"15 Jun 2012","cust_ref":"1229","payee":"Telephone Company","amt_trn":"-147.71","MTD Count":"6","Running Count":"42"},{"date_trn":"23 Jun 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"7","Running Count":"43"},{"date_trn":"01 Jul 2012","cust_ref":"1230","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"44"},{"date_trn":"01 Jul 2012","cust_ref":"1231","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"45"},{"date_trn":"08 Jul 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"3","Running Count":"46"}]}

In this Example we use a CASE statement and set @CountNulls to 'False' in order to count just the debits.

SELECT cast(convert(varchar, date_trn, 106) as char(11)) as date_trn,

       cust_ref,

       payee,

       amt_trn,

       wct.RunningCOUNT(   CASE

                               WHEN amt_trn > 0 THEN

                                   NULL

                               ELSE

                                   amt_trn

                           END,

                           ROW_NUMBER() OVER (PARTITION by MONTH(date_trn)ORDER 

                                     BY trn),

                           1,

                           'False'

                       ) as [MTD Count],

       wct.RunningCOUNT(   CASE

                               WHEN amt_trn > 0 THEN

                                   NULL

                               ELSE

                                   amt_trn

                           END,

                           trn,

                           NULL,

                           'False'

                       ) as [Running Count]

FROM #c

ORDER BY trn;

This produces the following result.

{"columns":[{"field":"date_trn","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cust_ref"},{"field":"payee"},{"field":"amt_trn","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"MTD Count","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Running Count","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_trn":"23 Dec 2011","cust_ref":"DD","payee":"NULL","amt_trn":"1500.00","MTD Count":"0","Running Count":"0"},{"date_trn":"01 Jan 2012","cust_ref":"1200","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"1"},{"date_trn":"01 Jan 2012","cust_ref":"1201","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"2"},{"date_trn":"08 Jan 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"2","Running Count":"2"},{"date_trn":"15 Jan 2012","cust_ref":"1202","payee":"Gas Company","amt_trn":"-108.49","MTD Count":"3","Running Count":"3"},{"date_trn":"15 Jan 2012","cust_ref":"1203","payee":"Electric Company","amt_trn":"-98.27","MTD Count":"4","Running Count":"4"},{"date_trn":"15 Jan 2012","cust_ref":"1204","payee":"Telephone Company","amt_trn":"-136.60","MTD Count":"5","Running Count":"5"},{"date_trn":"15 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"0","Running Count":"5"},{"date_trn":"01 Feb 2012","cust_ref":"1205","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"6"},{"date_trn":"01 Feb 2012","cust_ref":"1206","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"7"},{"date_trn":"08 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"2","Running Count":"7"},{"date_trn":"15 Feb 2012","cust_ref":"1207","payee":"Gas Company","amt_trn":"-153.89","MTD Count":"3","Running Count":"8"},{"date_trn":"15 Feb 2012","cust_ref":"1208","payee":"Electric Company","amt_trn":"-121.99","MTD Count":"4","Running Count":"9"},{"date_trn":"15 Feb 2012","cust_ref":"1209","payee":"Telephone Company","amt_trn":"-138.92","MTD Count":"5","Running Count":"10"},{"date_trn":"23 Feb 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"5","Running Count":"10"},{"date_trn":"01 Mar 2012","cust_ref":"1210","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"11"},{"date_trn":"01 Mar 2012","cust_ref":"1211","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"12"},{"date_trn":"08 Mar 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"2","Running Count":"12"},{"date_trn":"15 Mar 2012","cust_ref":"1212","payee":"Gas Company","amt_trn":"-70.79","MTD Count":"3","Running Count":"13"},{"date_trn":"15 Mar 2012","cust_ref":"1213","payee":"Electric Company","amt_trn":"-93.57","MTD Count":"4","Running Count":"14"},{"date_trn":"15 Mar 2012","cust_ref":"1214","payee":"Telephone Company","amt_trn":"-149.78","MTD Count":"5","Running Count":"15"},{"date_trn":"23 Mar 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"5","Running Count":"15"},{"date_trn":"01 Apr 2012","cust_ref":"1215","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"16"},{"date_trn":"01 Apr 2012","cust_ref":"1216","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"17"},{"date_trn":"08 Apr 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"2","Running Count":"17"},{"date_trn":"15 Apr 2012","cust_ref":"1217","payee":"Gas Company","amt_trn":"-105.58","MTD Count":"3","Running Count":"18"},{"date_trn":"15 Apr 2012","cust_ref":"1218","payee":"Electric Company","amt_trn":"-149.36","MTD Count":"4","Running Count":"19"},{"date_trn":"15 Apr 2012","cust_ref":"1219","payee":"Telephone Company","amt_trn":"-145.35","MTD Count":"5","Running Count":"20"},{"date_trn":"23 Apr 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"5","Running Count":"20"},{"date_trn":"01 May 2012","cust_ref":"1220","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"21"},{"date_trn":"01 May 2012","cust_ref":"1221","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"22"},{"date_trn":"08 May 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"2","Running Count":"22"},{"date_trn":"15 May 2012","cust_ref":"1222","payee":"Gas Company","amt_trn":"-96.27","MTD Count":"3","Running Count":"23"},{"date_trn":"15 May 2012","cust_ref":"1223","payee":"Electric Company","amt_trn":"-114.62","MTD Count":"4","Running Count":"24"},{"date_trn":"15 May 2012","cust_ref":"1224","payee":"Telephone Company","amt_trn":"-145.43","MTD Count":"5","Running Count":"25"},{"date_trn":"23 May 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"5","Running Count":"25"},{"date_trn":"01 Jun 2012","cust_ref":"1225","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"26"},{"date_trn":"01 Jun 2012","cust_ref":"1226","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"27"},{"date_trn":"08 Jun 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"2","Running Count":"27"},{"date_trn":"15 Jun 2012","cust_ref":"1227","payee":"Gas Company","amt_trn":"-147.03","MTD Count":"3","Running Count":"28"},{"date_trn":"15 Jun 2012","cust_ref":"1228","payee":"Electric Company","amt_trn":"-130.52","MTD Count":"4","Running Count":"29"},{"date_trn":"15 Jun 2012","cust_ref":"1229","payee":"Telephone Company","amt_trn":"-147.71","MTD Count":"5","Running Count":"30"},{"date_trn":"23 Jun 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"5","Running Count":"30"},{"date_trn":"01 Jul 2012","cust_ref":"1230","payee":"Car Leasing Company","amt_trn":"-361.75","MTD Count":"1","Running Count":"31"},{"date_trn":"01 Jul 2012","cust_ref":"1231","payee":"Mortgage Bank","amt_trn":"-1129.23","MTD Count":"2","Running Count":"32"},{"date_trn":"08 Jul 2012","cust_ref":"DD","payee":"NULL","amt_trn":"1100.00","MTD Count":"2","Running Count":"32"}]}