diff --git a/MoneyMap/Pages/Index.cshtml b/MoneyMap/Pages/Index.cshtml
index dd38a2c..e8c9a87 100644
--- a/MoneyMap/Pages/Index.cshtml
+++ b/MoneyMap/Pages/Index.cshtml
@@ -71,6 +71,7 @@
| Category |
Total Spend |
+ Avg Per Txn |
% of Total |
Txns |
@@ -85,6 +86,7 @@
@c.TotalSpend.ToString("C") |
+ @c.AveragePerTransaction.ToString("C") |
@c.PercentageOfTotal.ToString("F1")%
|
diff --git a/MoneyMap/Pages/Index.cshtml.cs b/MoneyMap/Pages/Index.cshtml.cs
index b124efb..cb162fa 100644
--- a/MoneyMap/Pages/Index.cshtml.cs
+++ b/MoneyMap/Pages/Index.cshtml.cs
@@ -45,6 +45,7 @@ namespace MoneyMap.Pages
public decimal TotalSpend { get; set; }
public int Count { get; set; }
public decimal PercentageOfTotal { get; set; }
+ public decimal AveragePerTransaction { get; set; }
}
public class RecentTxnRow
@@ -194,7 +195,8 @@ namespace MoneyMap.Pages
Category = g.Key,
TotalSpend = g.Sum(x => -x.Amount),
Count = g.Count(),
- PercentageOfTotal = totalSpend > 0 ? (g.Sum(x => -x.Amount) / totalSpend) * 100 : 0
+ PercentageOfTotal = totalSpend > 0 ? (g.Sum(x => -x.Amount) / totalSpend) * 100 : 0,
+ AveragePerTransaction = g.Count() > 0 ? g.Sum(x => -x.Amount) / g.Count() : 0
})
.OrderByDescending(x => x.TotalSpend)
.Take(count)