cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Ian_Farrell New Member
New Member

Cumulative, iterative total for a calculated column

Hi all, 

I have data that I need to do calculations on. I need a cumulative total (fine), but for certain lines in my data I need to use that cumulative total, do a calculation, then include the result of that calculation in that cumulative total so that the next row that needs to do that calculation it is starting with the right value. 

The calculation is a gain/loss on a pool of assets. 

Here's an example:

 

ABCDEFGH

I

J
Row #DateUSDCumulative USDFX rateCAD (C*D)ACB impact (if USD>$0, -F, otherwise, a calc is required)Cumulative ACB after transaction (sum of G)

ACB rate

(H/D)

Gain/loss

1

Jan 1

$100$1001.3$130$130$1301.3N/A
2Jan 2$100$2001$100$100$2301.15N/A
3Jan 3-$50$1501.2-$60-$57.5 ($60 USD * previous ACB rate)172.51.15$2.5 (60-57.5)
4Jan 4$100$2501.5$150$150$322.51.29N/A
5Jan 5-$50$2001-$50-$64.5($50 * 1.29)$2581.29-$14.5 (50-64.5)

 

My issue is that to calculate column G, I need the previous total of H. I can get this for the first gain/loss calc (row 3) using a SUM and EARLIER. But then for row 5, I need to G to include an earlier result of column G - maybe it needs to iterate through, or perhaps have something in a virtual table?

 

Sorry about the formatting. 

At a bit of a loss here, any thoughts would be appreciated

Thanks, 

Ian Farrell

1 REPLY 1
v-jayw-msft Senior Member
Senior Member

Re: Cumulative, iterative total for a calculated column

Hi @Ian_Farrell ,

 

I think column G and H and I have dependencies with each other which is not supported for DAX.
I suggest you try it in Excel.

 

Best Regards,

Jay

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)