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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Extracting iterative calculations in visualization to new table

Hi there,

I have built an iterative calculation table similar to the one described in this post:

 

https://community.powerbi.com/t5/Desktop/Iterative-Stock-Cover-Calculation/td-p/574257

 

Problem is that if i try to extract it into another table the iterations break and don't return appropriate values.  Have tried the SUMMARIZE and ADD columns functions to no avail.  Anyone run into this and been able to extract iterative calculations as they appear in the table visualization?


Would appreciate the help!

4 REPLIES 4
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

If is convenient, could you share some data sample which could reproduce your scenario and your desired output so that we could help further on it.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi there, can anyone help please?

Anonymous
Not applicable

Hi there,

Below is the sample data, quite simple really in terms of data (lol)

 

Column Names (| delimiter): Date|Disbursements|Payoff

Data: 

1/1/19|100,000|0

2/1/19|0|-1000

3/1/19|0|-2000

 

The goal is to start with an opening balance of 0, end January with a closing balance of 100,000, then February the opening balance should be 100,000 and the closing balance should be 99,000 and so on.

 

By following @OwenAuger 's sample i created the following sums/cumulative measures:

Sums:
Sumdisbursements = sum(Sample[Disbursements])
sumpayoff = sum(Sample[Payoff])

cumulatives:

 
CUMPayoff = Calculate(
[sumpayoff],
FILTER(
ALL(Sample[Date]),
Sample[Date]<= MAX(Sample[Date])))
 
CUMDisbursements = Calculate(
[Sumdisbursements],
FILTER(
ALL(Sample[Date]),
Sample[Date]<= MAX(Sample[Date])))
 
Closing balance calculation:
ClosingBalance = [CUMDisbursements]+[CUMPayoff]+[StartingBalance]
 
Opening balance calculation (its not working for me in the sample not sure why):
OpeningBalance = Calculate(
[ClosingBalance],
FILTER(
ALL('Sample'[Date]),
'Sample'[Date]<=MIN('Sample'[Date])-1))
 
Starting balance of 0
StartingBalance = 0
 
Need help in fixing the opening balance and in extracting the result of the table visualization into a new table...hope this makes sense.
Anonymous
Not applicable

Really need everyone's help, please.  

 

Here is the structure of the iterative calculation:

 

CUMAdjMiscAdjustments = Calculate(
[SUMAdjMiscAdjustments],
FILTER(
ALL(PrincipalEdit[CurrentDate]),
PrincipalEdit[CurrentDate]<= MAX(PrincipalEdit[CurrentDate])))
 
I am taking cumulative totals using the date as the reference/anchor point.  The above is just a sample of a few of the factors that I am calculating.
 
The factors add up to a total for the closing principal balance, see below for formula:
 
ClosingPrincipal = [StartingBalanceMOB0]+[CUMDisbursementsNEW]+[CUMDisbursementsREW]+[CUMOrigFeeTXIL]+[CUMPrinCOwTXIL]+[CUMPrepaidPrincipal]+[CUMSchedPrincipalPayment]+[CUMPrincipalRewrites]+[CUMPrincipalRefinance]+[CUMCredits]+[CUMOverpaidPrincipal]+[CUMAdjMiscAdjustments]
 
The iteration is that the Opening principal for the next month is the closing principal for the PRIOR month.  Formula for the Opening principal is below:
 
OpeningPrincipal = Calculate(
[ClosingPrincipal],
FILTER(
ALL(PrincipalEdit[CurrentDate]),
PrincipalEdit[CurrentDate]<=MIN(PrincipalEdit[CurrentDate])-1))
 
The above tells PowerBI to pull the closing principal date for the month prior.
 
Now this all works great when i put it into a TABLE visualization, but i can't extract this data (I have more than 30K rows) and I can't pull this into a table because the iteration for the measures breaks when i pull it into another table using the SUMMARIZE or ADDCOLUMNS formulas.
 
Has anyone been able to succeed in doing something similar?  Can you please share how you were able to take the calculated data in the visualization table and either extract it or place it into a new table?
 
Appreciate the help.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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