Important Financial Functions in DAX in Power BI

Important Financial Functions in DAX in Power BI

DAX provides several financial functions to calculate values like interest, depreciation, or loan repayment schedules. These functions are helpful in financial modeling and analysis.

Here are some important financial functions with examples using a Sample Dataset:


1. PMT()

  • Purpose: Calculates the payment for a loan based on constant payments and a constant interest rate.
  • Syntax: PMT(rate, nper, pv, [fv], [type])
    • rate: Interest rate per period.
    • nper: Total number of payment periods.
    • pv: Present value (loan amount).
    • fv: Future value (default is 0).
    • type: Payment timing (0 = end of the period, 1 = beginning).

Dataset:

Loan IDLoan Amount (pv)Interest Rate (%)Periods (nper)
110000512
25000724

DAX Formula:

Monthly Payment = 
PMT(
    'Loans'[Interest Rate] / 100 / 12,
    'Loans'[Periods],
    -'Loans'[Loan Amount]
)

Output:

Loan IDMonthly Payment
1-856.07
2-230.29

2. FV()

  • Purpose: Calculates the future value of an investment based on constant periodic payments and a constant interest rate.
  • Syntax: FV(rate, nper, pmt, [pv], [type])
    • pmt: Payment made each period.
    • pv: Present value (default is 0).

Dataset:

Investment IDMonthly Payment (pmt)Interest Rate (%)Periods (nper)
1500612
2300424

DAX Formula:

Future Value = 
FV(
    'Investments'[Interest Rate] / 100 / 12,
    'Investments'[Periods],
    -'Investments'[Monthly Payment]
)

Output:

Investment IDFuture Value
16180.42
27568.79

The negative sign (-) in - 'Investments'[Monthly Payment] is used to align with the cash flow convention commonly followed in financial calculations. Here’s the reasoning:

Cash Flow Convention

  • Outflows (Payments): Represent money going out of your pocket, which are treated as negative values.
  • Inflows (Receipts): Represent money coming into your pocket, which are treated as positive values.

Application in the Formula

In financial functions like FV(), PV(), or PMT():

  • The payment amount (pmt) or present value (pv) is treated as an outflow, so it’s negative.
  • The future value (fv) is typically treated as an inflow, so it’s positive.

By using - 'Investments'[Monthly Payment], we are indicating that this is a cash outflow.


Example: Future Value (FV())

Suppose you are investing $500 every month at a 6% annual interest rate for 12 months. The formula:

Future Value = FV(6/100/12, 12, -500)

Here:

  • -500: Represents the monthly payment you are investing (outflow).
  • The function will calculate the total value you will receive (inflow) at the end of the period.

Why Not Make Payments Positive?

If you don’t use the negative sign, the financial function may interpret your payment as an inflow (money received), which would lead to incorrect results.


Real-World Perspective

This convention helps maintain clarity in scenarios where:

  1. You pay money today (negative) to get a return later (positive).
  2. You receive money today (positive) and pay it back in installments (negative).

By keeping the signs consistent, the formulas align with real-world cash flow analysis.

3. PV()

  • Purpose: Calculates the present value of an investment or loan based on periodic, constant payments and a constant interest rate.
  • Syntax: PV(rate, nper, pmt, [fv], [type])

Dataset:

Loan IDMonthly Payment (pmt)Interest Rate (%)Periods (nper)
1300836
2500524

DAX Formula:

Present Value = 
PV(
    'Loans'[Interest Rate] / 100 / 12,
    'Loans'[Periods],
    -'Loans'[Monthly Payment]
)

Output:

Loan IDPresent Value
18565.46
210685.79

4. XNPV()

  • Purpose: Calculates the net present value (NPV) for a schedule of cash flows that is not necessarily periodic.
  • Syntax: XNPV(rate, values, dates)

Dataset:

Transaction DateCash Flow (values)
2023-01-01-5000
2023-06-012000
2023-12-014000

DAX Formula:

Net Present Value = 
XNPV(
    0.05,
    'CashFlows'[Cash Flow],
    'CashFlows'[Transaction Date]
)

Output:

Net Present Value
784.21

5. XIRR()

  • Purpose: Returns the internal rate of return for a schedule of cash flows that are not necessarily periodic.
  • Syntax: XIRR(values, dates)

Dataset:

Transaction DateCash Flow (values)
2023-01-01-10000
2023-06-013000
2023-12-018000

DAX Formula:

Internal Rate of Return = 
XIRR(
    'CashFlows'[Cash Flow],
    'CashFlows'[Transaction Date]
)

Output:

Internal Rate of Return
0.115 (11.5%)

Summary of Key Financial Functions

FunctionDescription
PMT()Calculates periodic payment for a loan.
FV()Calculates the future value of an investment.
PV()Calculates the present value of an investment or loan.
XNPV()Calculates the net present value for irregular cash flows.
XIRR()Calculates the internal rate of return for irregular cash flows.

These financial functions are powerful tools for financial modeling and can be tailored for business scenarios like loan payments, investment growth, and profitability analysis in Power BI.