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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
wiz329
New Member

Calculating payback period

I'm working on some calculations for capital budgeting, and I have the following two tables in my data model:

Project Table.PNGImpact Table.PNG

 

I'm trying to build out a calculated column in DAX to determine the payback period for each project in the Project table. I've put together the calculation here, I'm just not sure exactly how to execute this in DAX.

 

Logical Steps for Calculating Payback Period:

  1. For each Project, find the cumulative sum for each date for relevant metrics (Include OpEx Savings and OpEx Implementation Cost, but not Revenue or Working Capital)

  2. Find the MIN date where cumulative sum is greater than zero (the "break-even" date")

  3. Find the MIN date with non-zero implementation cost ("Investment date")

  4. Find the difference (in months) between #2 and #3 to determine payback period

 

1 ACCEPTED SOLUTION
wiz329
New Member

After a fair amount of trial and error, I came up with a solution.

 

Step 1: Build out a helper metrics table. This serves 2 purposes: (a) excludes irrelevant metrics (like revenue), and (b) ensure costs are negative and savings are positive.

 

 

Metrics Table.PNG

 

Step 2: Build 2 helper measures that will go into the virtual, summarized, intermediate table.

 

CumulativeTotalMetric:=CALCULATE (
    SUMX (
        Impact,
        Impact[Latest Estimate Monthly Values]
            * RELATED ( BaseMetrics[Payback Period Multiplier] )
    ),
    FILTER ( ALL ( Impact[Month] ), Impact[Month] <= MAX ( Impact[Month] ) )
)
TotalMetric:=SUMX (
    Impact,
    Impact[Latest Estimate Monthly Values]
        * RELATED ( BaseMetrics[Payback Period Multiplier] )
)

Step 3: Create the final measure that creates the virtual table (BaseTable), and performs logical operations on it to arrive at the final payback period.

 

Payback Period (Years):=
VAR BaseTable = ADDCOLUMNS ( SUMMARIZE ( Impact, Impact[initiative #], Impact[snapshot], Impact[Month] ), "Cumulative Total Impact", CALCULATE ( [CumulativeTotalMetric] ), "Total Impact", CALCULATE ( [TotalMetric] ) ) VAR LastCumulativeLossDate = MAXX ( FILTER ( BaseTable, [Cumulative Total Impact] < 0 ), [Month] ) VAR BreakEvenDate = MINX ( FILTER ( BaseTable, [Month] > LastCumulativeLossDate && [Cumulative Total Impact] > 0 ), [Month] ) VAR InitialInvestmentDate = MINX ( FILTER ( BaseTable, [Total Impact] < 0 ), [Month] ) RETURN IF ( OR ( ISBLANK ( InitialInvestmentDate ), ISBLANK ( BreakEvenDate ) ), BLANK (), ( BreakEvenDate - InitialInvestmentDate ) / 365 )

This last meaure is pretty complicated. It uses progressive, dependent variables. It starts with the same base table, and defines variables that are used in subsequent variables. I'm no DAX expert, but I suspect using these variables helps with the calculation efficiency.

View solution in original post

1 REPLY 1
wiz329
New Member

After a fair amount of trial and error, I came up with a solution.

 

Step 1: Build out a helper metrics table. This serves 2 purposes: (a) excludes irrelevant metrics (like revenue), and (b) ensure costs are negative and savings are positive.

 

 

Metrics Table.PNG

 

Step 2: Build 2 helper measures that will go into the virtual, summarized, intermediate table.

 

CumulativeTotalMetric:=CALCULATE (
    SUMX (
        Impact,
        Impact[Latest Estimate Monthly Values]
            * RELATED ( BaseMetrics[Payback Period Multiplier] )
    ),
    FILTER ( ALL ( Impact[Month] ), Impact[Month] <= MAX ( Impact[Month] ) )
)
TotalMetric:=SUMX (
    Impact,
    Impact[Latest Estimate Monthly Values]
        * RELATED ( BaseMetrics[Payback Period Multiplier] )
)

Step 3: Create the final measure that creates the virtual table (BaseTable), and performs logical operations on it to arrive at the final payback period.

 

Payback Period (Years):=
VAR BaseTable = ADDCOLUMNS ( SUMMARIZE ( Impact, Impact[initiative #], Impact[snapshot], Impact[Month] ), "Cumulative Total Impact", CALCULATE ( [CumulativeTotalMetric] ), "Total Impact", CALCULATE ( [TotalMetric] ) ) VAR LastCumulativeLossDate = MAXX ( FILTER ( BaseTable, [Cumulative Total Impact] < 0 ), [Month] ) VAR BreakEvenDate = MINX ( FILTER ( BaseTable, [Month] > LastCumulativeLossDate && [Cumulative Total Impact] > 0 ), [Month] ) VAR InitialInvestmentDate = MINX ( FILTER ( BaseTable, [Total Impact] < 0 ), [Month] ) RETURN IF ( OR ( ISBLANK ( InitialInvestmentDate ), ISBLANK ( BreakEvenDate ) ), BLANK (), ( BreakEvenDate - InitialInvestmentDate ) / 365 )

This last meaure is pretty complicated. It uses progressive, dependent variables. It starts with the same base table, and defines variables that are used in subsequent variables. I'm no DAX expert, but I suspect using these variables helps with the calculation efficiency.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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