• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Running Balance based on difference of 2 rows plus the previous row.|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Running Balance based on difference of 2 rows plus the previous row.|Power Query|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryRunning Balance based on difference…
sp_PrintTopic sp_TopicIcon
Running Balance based on difference of 2 rows plus the previous row.
Avatar
John Canlas

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 2, 2023
sp_UserOfflineSmall Offline
1
May 2, 2023 - 10:40 pm
sp_Permalink sp_Print

Hello, 

I hope you are all well.

I'm just an average excel user. I need help to create a power query for running balance/total.

Basically in an ordinary excel formula, I can compute for running balance/ total by:

1st row -> Payout - Cash in (B2-A2)

2nd row -> Payout - Cash in + difference of previous row (B3-A3) + C2.

3rd row -> Payout - Cash in + difference of previous row (B4-A4) + C3.

So on and so forth...

Cash in Payout Running Balance
0.25 0 -0.25
0.75 0 -1
1.5 0.5 -2
1.25 0.5 -2.75
1 0 -3.75
0.25 0 -4
0.75 0.3 -4.45
0.5 0 -4.95
2.25 0 -7.2
2.25 0 -9.45
0.75 2.5 -7.7
1 0 -8.7

Can anyone help me please apply this in power query? I know I could just use the basic formula, but the reason why I want it in power query is because, I also have an updating data that I have also made some formatting in power query and I wanted to integrate this with my existing.

Appreciate if you can be detailed in the explanation that you will be providing. Thank you so much in advance.

Here is the link to my excel file: https://1drv.ms/x/s!AtBSy5wV0o.....g?e=lqbbaQ

 

Kind regards,

John

sp_AnswersTopicSeeAnswer See Answer
Avatar
Jessica Stewart
Northern USA
Member
Members


Trusted Members
Level 0
Forum Posts: 216
Member Since:
February 13, 2021
sp_UserOfflineSmall Offline
2
May 3, 2023 - 12:57 am
sp_Permalink sp_Print

Mynda has a great video on the subject, you can find it here, come back if you need further help.

sp_AnswersTopicAnswer
Answers Post
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1529
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
3
May 3, 2023 - 12:34 pm
sp_Permalink sp_Print

Hi John,

This isn't your typical Running Total so the code I wrote for Power Query Running Totals would not work without modification.

So, I've written a different query that uses List.Sum and List.FirstN to SUM the differences between each row.  This requires creating a temp column to calculate these differences, then you just sum them.

See attached file.

Regards

Phil

Avatar
John Canlas

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 2, 2023
sp_UserOfflineSmall Offline
4
May 3, 2023 - 7:48 pm
sp_Permalink sp_Print

Hi Team,

 

Thank you so much for your help I was now able to make it work. Appreciate it so much.

More power!

 

Kind regards,

John

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Rashid Khan
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 216
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Melanie Ford
Isaac Felbah
Adele Glover
Hitesh Asrani
Rohan Abraham
Anthony van Riessen
Erlinda Eloriaga
Abisola Ogundele
MARTYN STERRY
Rahim Lakhani
Forum Stats:
Groups: 3
Forums: 24
Topics: 6356
Posts: 27793

 

Member Stats:
Guest Posters: 49
Members: 32324
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.