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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Jtbonner1986
Helper I
Helper I

Power BI Dax - How to calculate running totals (line of balance) with a starting total

Hi, 

 

I poseted something similar before but didnt get a solution that worked. 

 

I am trying to get a predicted running stock total. I have 3 dimentions [Current Stock], [Useage], [Purchases] 

 

The calulation for month 1 is ([Current Stock] + [purchases (for month 1]) - [usage (for month 1)] 

 

Then the following month the calculation will use the previous months output and then calculate the current months purchases - the current month usage. If there is no data for a pactiular month then usage or purchases should be classes as 0 and the stock would roll over to the next month.  The issue to the previous solution was when there was no data for some months the calculation would break 

 

Example data and example outputs are below:

 

Current Stock;

MaterialStock on Hand
A100
B500
C1000

 

Purchases

MaterialPurchDateQuantity
A01/01/202310
A01/02/202320
A01/04/202330
B01/01/202310
B01/02/202320
B01/04/202315

 

Usage

MaterialUseageDateQuantity
A01/01/202350
A01/02/202310
A01/04/202320
B01/01/202310
B01/02/202330
B01/04/202340

 

What i want to do is create a table within power bi that outputs a visual with a running total calculated like the below. I have a calendar table already created:

 

 

Material01/01/202301/02/202301/03/202301/04/2023
A60707080
B410420420395

 

(Stock on hand + Purch) - Usage(Previous month LoB + Purchases) - usage

 

hope you can help

 

Many thanks in advance

Josh

 

 

 

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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