diff --git a/hledger/Hledger/Cli/Balance.hs b/hledger/Hledger/Cli/Balance.hs index bcc69ea6a..dfb9d99a5 100644 --- a/hledger/Hledger/Cli/Balance.hs +++ b/hledger/Hledger/Cli/Balance.hs @@ -531,8 +531,8 @@ balanceReportAsTable opts (MultiBalanceReport (colspans, items, (coltotals,tot,a addtotalrow | no_total_ opts = id | otherwise = (+----+ (row "" $ coltotals - ++ (if row_total_ opts then [tot] else []) - ++ (if average_ opts then [avg] else []) + ++ (if row_total_ opts && not (null coltotals) then [tot] else []) + ++ (if average_ opts && not (null coltotals) then [avg] else []) )) -- | Figure out the overall date span of a multicolumn balance report. diff --git a/hledger/Hledger/Cli/BalanceView.hs b/hledger/Hledger/Cli/BalanceView.hs index 860968b63..283da0741 100644 --- a/hledger/Hledger/Cli/BalanceView.hs +++ b/hledger/Hledger/Cli/BalanceView.hs @@ -148,8 +148,8 @@ balanceviewReport BalanceView{..} CliOpts{command_=cmd, reportopts_=ropts, rawop mergedTabl +====+ row "Total" - (sumAmts ++ (if row_total_ ropts' then [totsum] else []) - ++ (if average_ ropts' then [totavg] else []) + (sumAmts ++ (if row_total_ ropts' && not (null sumAmts) then [totsum] else []) + ++ (if average_ ropts' && not (null sumAmts) then [totavg] else []) ) putStrLn title putStrLn $ renderBalanceReportTable ropts totTabl