Power Pivot Running totals

shophoney

Active Member
Joined
Jun 16, 2014
Messages
281
Hello,

I'm trying to figure out how to build a calculated column with a running total of payments against an invoice.

So below is an example:
Invoice #3322999 is for $14,387.86. We have 2 credits against the invoice. CN3325633 $167.44 and CN 3326818 $229.32

I'd like to see the Original amount less 1st credit = 14220.42
2nd credit = $13991.10

I need to provide a list of payments or credit and the balance.

This can be either with a measure or calculated column. Not sure which is better.

I tried pulling in the TrasactionAmount and selecting running total. But that didn't work.

Thanks

1616104477078.png
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Power Query:
=
VAR ref=Table1[RefrenceNumber]
VAR Amount=Table1[Amount]
RETURN CALCULATE(Amount+
    SUM(Table1[TransactionAmount]);
    FILTER(Table1;Table1[RefrenceNumber]=ref &&Table1[TransactionAmount]>=EARLIER(Table1[TransactionAmount]))
    )
 
Upvote 0
Power Query:
=
VAR ref=Table1[RefrenceNumber]
VAR Amount=Table1[Amount]
RETURN CALCULATE(Amount+
    SUM(Table1[TransactionAmount]);
    FILTER(Table1;Table1[RefrenceNumber]=ref &&Table1[TransactionAmount]>=EARLIER(Table1[TransactionAmount]))
    )
Hi,

Just to confirm this should be added to power Query?

I tried both making a measure and calculated column. But couldn't.

It's so easy to make a formula within Excel to address this. But given the range, vendor list and invoice list changes. It just wont work.

Best to have everything in the back end, Power Query or Power Pivot.

Thanks for your help.
 
Upvote 0
Sorry this is for a calculated column in Power Pivot.
 
Upvote 0
Sorry this is for a calculated column in Power Pivot.
Thanks,

I put it in as a Calculated Column.

But the results seem wrong. I've displayed what the totals should be beside it.

1616178991987.png


=

VAR ref='Bill HISTORY'[ReferenceNumber]

VAR Amount='Bill HISTORY'[Amount]

RETURN CALCULATE(Amount+

SUM('Bill HISTORY'[TransactionAmount]), FILTER('Bill HISTORY','Bill HISTORY'[ReferenceNumber]=ref &&'Bill HISTORY'[TransactionAmount]>=EARLIER('Bill HISTORY'[TransactionAmount]))

)
 
Upvote 0
I think it is easier if the data is within the same column to do a running total.

+14387.86
-167.44
-229.32

You could accomplish it using List.Sum and List.Range in the M code.
 
Upvote 0
See that you have added a date column. Try this:
1616233678204.png
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top