Given your data and requirements, I've got the following which appears to work - fairly ugly though

```
select
'Today' as period
, count( * ) as records
, sum( convert( money, t.price_sum )) as total
, sum( convert( money, t.price_sum )) / count( * ) as [$/record]
from #tmp_GridResults_1 t
where
t.today = 1
union all
select
'Yesterday' as period
, count( * ) as records
, sum( convert( money, t.price_sum )) as total
, sum( convert( money, t.price_sum )) / count( * ) as [$/record]
from #tmp_GridResults_1 t
where
t.yesterday = 1
union all
select
'This month' as period
, count( * ) as records
, sum( convert( money, t.price_sum )) as total
, sum( convert( money, t.price_sum )) / count( * ) as [$/record]
from #tmp_GridResults_1 t
where
t.thismonth = 1
union all
select
'Last month' as period
, count( * ) as records
, sum( convert( money, t.price_sum )) as total
, sum( convert( money, t.price_sum )) / count( * ) as [$/record]
from #tmp_GridResults_1 t
where
t.lastmonth = 1
;
```

Now if the periods were a little more even and had a datetime field, then you could do something like

```
select
dateadd( month, datediff( month, 0, t.TransactionDate ), 0 ) as StartOfPeriod
, count( * ) as Records
, sum( t.TransactionValue ) as Total
, sum( t.TransactionValue ) / count( * ) as AverageTransaction
from dbo.TransactionTable t
where
somewhereclause
group by
dateadd( month, datediff( month, 0, t.TransactionDate ), 0 )
order by
dateadd( month, datediff( month, 0, t.TransactionDate ), 0 )
;
```

HTH

David