Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
LarsMartin
Frequent Visitor

How to caculate the net present value (npv) without a timeseries table

Hi,

 

I am still relatively new to PowerBi DAX and would like to calculate the net present value for each row without an existing time series. This is what my data looks like.

Implementation measureSum of InvestmentSum of savings p.a.period rateNet present value
21.6 kWp system (roof 1 + roof 2 & 32 kW water-water heat pump4260081501515% 
Air-water heat pump with 65°C flow temperature3400017972010% 
Air-water heat pump with temperature reductions to 45°C4400014961510% 
Air-water heat pump with temperature reductions to 55°C440001901015% 

The table must be in direct query mode.

 

I have some Implementation measures with an investment, savings per anno, rate and a period of time in years. The npv should be calculated for each row. The capital return for each year is equal to the savings p.a.. over the time in the column "period".

 

What I have tried so far:

 

1. Use the xnpv funktion in DAX. The funktion needs a table with the values, dates and a rate.
Within the definition of the calculated column, I created a table with a time series and the value of the savings. This worked on the DAX.do website, but it seems to work only for measures and not for calculated columns.

(Example for the first row of my table):

VAR rate= 0.15
TABLE Zeitreihe = ADDCOLUMNS  (
            GENERATESERIES (
                2021,
                2035,
                1
            ), "year" , DATE([Value],01,01) ,
                "_value" , 8150)
        )
VAR NBW = -42600 + XNPV (Zeitreihe,[_value],[year],rate)

RETURN
{    
    NBW
}

 

2. Tried to to do a DAX for the calculated column with some kind of a loop and calculate the npv with the formula

 

npv= Investment + Sum over period (value/(1+rate)^time).

But I do not know how to loop over the period.

 

Best regards 

Lars

 

         

3 REPLIES 3
bhanu_gautam
Super User
Super User

@LarsMartin , Try using

Net Present Value =
VAR Investment = [Sum of Investment]
VAR Savings = [Sum of savings p.a.]
VAR Rate = [rate]
VAR Period = [period]
VAR DiscountedSavings =
SUMX(
GENERATESERIES(1, Period, 1),
Savings / POWER(1 + Rate, [Value])
)
RETURN
-Investment + DiscountedSavings




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi,

thamnks for the fast reply, but I get the error: "Function 'SUMX' is not allowed as part of calculated column DAX expressions on DirectQuery models."

 

As stated above, I have to do it in DirectQueryMode.

 

Best regards

Lars

johnt75
Super User
Super User

I think you can create a calculated column like

Net present Value Column Table =
VAR rate = 'Table'[Rate]
VAR StartYear =
    YEAR ( 'Table'[Investment date] )
VAR EndYear = StartYear + 'Table'[Period]
VAR Zeitreihe =
    ADDCOLUMNS (
        GENERATESERIES ( StartYear, EndYear, 1 ),
        "year", DATE ( [Value], 01, 01 ),
        "_value", 'Table'[Savings p.a.]
    )
VAR NBW =
    ( -1 * 'Table'[Investment Amount] )
        + XNPV ( Zeitreihe, [_value], [year], rate )
RETURN
    { NBW }

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.