Skip to content
Merged
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,12 @@ function recalculate(
});
});

const priorPeriodNetWorth = data.reduce(
(sum, account) => sum + account.starting,
0,
);

let hasNegative = false;
let startNetWorth = 0;
let endNetWorth = 0;
let lowestNetWorth: number | null = null;
let highestNetWorth: number | null = null;
Expand Down Expand Up @@ -236,11 +240,8 @@ function recalculate(
x = d.parseISO(intervalItem + '-01');
}

const change = last ? total - last.y : 0;
const change = last ? total - last.y : total - priorPeriodNetWorth;

if (arr.length === 0) {
startNetWorth = total;
}
endNetWorth = total;

// Use standardized format from ReportOptions
Expand Down Expand Up @@ -292,7 +293,7 @@ function recalculate(
end: endDate,
},
netWorth: endNetWorth,
totalChange: endNetWorth - startNetWorth,
totalChange: endNetWorth - priorPeriodNetWorth,
lowestNetWorth,
highestNetWorth,
accounts: data
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/6968.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfixes
authors: [PratikSilwal5]
---

Correctly calculate the net worth change value on the first month of the report.
Loading