Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I have a table with transactions, each transaction has a "gap". The gap indicates either a surplus (positive gap) or a deficit (negative gap). I am trying to calculate the accumulated deficit.
Here is how I was able to achieve it in Excel:
the formula for accumulated surplus =IF(C3+E2>0, 0, C3+E2)
the formula for accumulated deficit `=IF(C3<=0,D2,IF(AND(C3>0,C3+E2<0),D2,(C3+E2+D2)))
| n | Gap | Accumulated Deficit | Accumulated Surplus |
| 1 | 0 | 0 | 0 |
| 2 | 20 | 20 | 0 |
| 3 | -12 | 20 | -12 |
| 4 | 5 | 20 | -7 |
| 5 | 11 | 24 | 0 |
| 6 | 0 | 24 | 0 |
| 7 | -3 | 24 | -3 |
| 8 | 1 | 24 | -2 |
| 9 | -7 | 24 | -9 |
| 10 | -2 | 24 | -11 |
| 11 | -1 | 24 | -12 |
| 12 | 3 | 24 | -9 |
| 13 | 0 | 24 | -9 |
Any help would be appreciated!
Hello!
Did you figure out a way to do this? 🙂
@hmayol ,
Could you provide some sample data and the expected result, so that I can help you.
The information that you have provided is not clear. What is C3, E2 and D2. I think this are the cell references in the excel file.
Please provide sample data to understand your requirement.
Regards,
Pavan Vanguri.
@Anonymous
I have two files here
Let me know if you need anymore information.
Thanks,
Hector M.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 33 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |