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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
adin
Helper I
Helper I

Modelling future cashflows using GENERATESERIES

I'm trying to convert an old financial model that was built in excel (using macros and hence running slow) into power bi.

 

I'm trying to model future cash flows for each loan in my dataset but am struggling to figure how to use generate series along with calculations (in measure) in order to execute each calc per loan per future period. the ultimate end result is i want to be able to slice and dice the numbers not just have one aggregate total 

 

I managed to work out the logic to calculate future loan value based on runoff rate I look up in a reference table, but now am stuck because the formula only works for one loan (i.e. only when i filter one loan at a time) . the formula for the projected future loan value is below along with a screenshot of the output filtered for only one loan. When I remove the filter the measure breaks.

 

the result I'm after is the total value of all loans at each future period. 

 

FuturePeriods = GENERATESERIES(0,132,1)
RunOffRate = 

var FuturePeriodsTable = CROSSJOIN(NetPresentValueData,FuturePeriods)

Var Loan_duration = SUMX(FuturePeriodsTable,NetPresentValueData[Tenure_months] + FuturePeriods[FuturePeriod])

Var DurationCutOffLookup = CALCULATE(max(RunOffRates[DurationBand CutOff]),RunOffRates[DurationBand CutOff]<=Loan_duration)

Return

if(SELECTEDVALUE(FuturePeriods[FuturePeriod]) = 0, 0,

SWITCH(SELECTEDVALUE(NetPresentValueData[GroupId]),

"Group1", LOOKUPVALUE(RunOffRates[group1],RunOffRates[DurationBand CutOff],DurationCutOffLookup)/12,

"Group2", LOOKUPVALUE(RunOffRates[group2],RunOffRates[DurationBand CutOff],DurationCutOffLookup)/12

))

 

Projected Balance = 

VAR OriginalBalance = MAX(NetPresentValueData[Total_current_balance])

VAR __d = MAX ( FuturePeriods[FuturePeriod] )

RETURN

OriginalBalance * CALCULATE ( PRODUCTX(FuturePeriods, (1 - 'Measures Table'[RunOffRate]) ), ALLSELECTED (FuturePeriods), FuturePeriods[FuturePeriod] <= __d )

Screenshot 2022-01-12 082500.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Having difficulty working with iterator functions, which is what I'm assuming this needs 

 

Thanks for any help you can provide

 

2 REPLIES 2
Anonymous
Not applicable

Hi @adin ,

 

Have difficult to follow. Please take a look at the topic about How-to-Get-Your-Question-Answered-Quickly .

Also please share the logic of your formula and which SELECTEDVALUE function is you mentioned above.

 

Best Regards,

Jay

adin
Helper I
Helper I

i think the error is when i use the SELECTEDVALUE function, but I can not figure how to do it without it 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors