Calculate the money-weighted return of your portfolio accounting for cash flows.
Total calendar days for the performance period.
External Cash Flows
Enter deposits as positive numbers and withdrawals as negative numbers. "Day" is the number of days from the start of the period.
Performance Analysis
Investment Gain/Loss:
Average Capital Employed:
Modified Dietz Return:
function calculateModifiedDietz() {
// Get Core Inputs
var bmv = parseFloat(document.getElementById('md_bmv').value) || 0;
var emv = parseFloat(document.getElementById('md_emv').value) || 0;
var totalDays = parseFloat(document.getElementById('md_days').value);
// Validation
if (isNaN(totalDays) || totalDays <= 0) {
alert("Please enter a valid number for Total Days in Period.");
return;
}
// Get Cash Flows
var cf1_amt = parseFloat(document.getElementById('md_cf1_amt').value) || 0;
var cf1_day = parseFloat(document.getElementById('md_cf1_day').value) || 0;
var cf2_amt = parseFloat(document.getElementById('md_cf2_amt').value) || 0;
var cf2_day = parseFloat(document.getElementById('md_cf2_day').value) || 0;
var cf3_amt = parseFloat(document.getElementById('md_cf3_amt').value) || 0;
var cf3_day = parseFloat(document.getElementById('md_cf3_day').value) || 0;
var cf4_amt = parseFloat(document.getElementById('md_cf4_amt').value) || 0;
var cf4_day = parseFloat(document.getElementById('md_cf4_day').value) || 0;
// Arrays for easier processing
var cfAmts = [cf1_amt, cf2_amt, cf3_amt, cf4_amt];
var cfDays = [cf1_day, cf2_day, cf3_day, cf4_day];
// 1. Calculate Total Net Cash Flow (Sum of C)
var totalNetCashFlow = 0;
for (var i = 0; i < cfAmts.length; i++) {
totalNetCashFlow += cfAmts[i];
}
// 2. Calculate Investment Gain
// Gain = EMV – BMV – Total Cash Flows
var gain = emv – bmv – totalNetCashFlow;
// 3. Calculate Weighted Cash Flows
// Formula: Sum(CF * (TotalDays – DayOccurred) / TotalDays)
var weightedCashFlowSum = 0;
for (var i = 0; i < cfAmts.length; i++) {
if (cfAmts[i] !== 0) {
var day = cfDays[i];
// Ensure day is within bounds
if (day totalDays) day = totalDays;
var weight = (totalDays – day) / totalDays;
weightedCashFlowSum += (cfAmts[i] * weight);
}
}
// 4. Calculate Average Capital Employed (Denominator)
// BMV + Weighted Cash Flows
var avgCapital = bmv + weightedCashFlowSum;
// 5. Calculate Modified Dietz Return
var ror = 0;
if (avgCapital !== 0) {
ror = gain / avgCapital;
}
// Formatting Results
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
});
var percentFormatter = new Intl.NumberFormat('en-US', {
style: 'percent',
minimumFractionDigits: 2,
maximumFractionDigits: 2
});
document.getElementById('res_gain').innerText = formatter.format(gain);
document.getElementById('res_avg_cap').innerText = formatter.format(avgCapital);
document.getElementById('res_ror').innerText = percentFormatter.format(ror);
// Coloring Logic for Return
var rorEl = document.getElementById('res_ror');
if (ror > 0) rorEl.style.color = "#27ae60";
else if (ror < 0) rorEl.style.color = "#c0392b";
else rorEl.style.color = "#2c3e50";
// Show results section
document.getElementById('dietz-results').style.display = 'block';
}
What is the Modified Dietz Method?
The Modified Dietz Method is a financial metric used to calculate the historical rate of return for an investment portfolio. Unlike a simple return calculation (End Value / Start Value – 1), the Modified Dietz method accounts for external flows of capital—deposits (contributions) and withdrawals—based on the timing of when they occurred.
It is widely considered a "money-weighted" rate of return approximation that provides a more accurate picture of investment manager performance than simple returns, especially in volatile markets where the timing of cash flows can significantly skew results.
The Formula
The calculation is based on the following formula:
Return = (EMV – BMV – C) / (BMV + WC)
EMV: Ending Market Value of the portfolio.
BMV: Beginning Market Value of the portfolio.
C: Total Net Cash Flow (Contributions minus Withdrawals).
WC: Weighted Cash Flow.
How to Calculate Weighted Cash Flow
The "weight" of a cash flow depends on how long the money was available to be invested during the period. The formula for the weight of a specific cash flow ($W_i$) is:
W = (Total Days in Period – Days Since Start) / Total Days in Period
If you deposit $1,000 exactly halfway through a 30-day month, the weight is 0.5. The calculator then multiplies the amount ($1,000) by the weight (0.5) to determine that $500 was effectively "employed" for the full period.
Example Calculation
Imagine a portfolio with the following details for a 30-day month:
Beginning Value: $100,000
Ending Value: $105,000
Contribution: $5,000 deposited on Day 15.
Step 1: Calculate Gain.
Gain = $105,000 – $100,000 – $5,000 = $0 (The portfolio value increased only by the amount of the deposit).
Step 2: Calculate Weighted Capital.
The $5,000 was there for 15 days (Day 15 to Day 30).
Weight = (30 – 15) / 30 = 0.5.
Weighted Cash Flow = $5,000 × 0.5 = $2,500.
Average Capital = $100,000 (Start) + $2,500 = $102,500.
Step 3: Result.
Return = $0 / $102,500 = 0.00%.
Why Use Modified Dietz?
This method balances accuracy with computational simplicity. While the "Internal Rate of Return" (IRR) is theoretically the most precise money-weighted return, it requires iterative calculations that can be complex. Modified Dietz offers a linear approximation that adheres to GIPS (Global Investment Performance Standards) for periods where return volatility is not extreme.