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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Current day Ending balance should show up as Starting balance for next day

Hello Folks,

 

Need your help to figure out this interesting qusetion.

How to write a DAX expression/measure to show currrent day ending balance as a Starting balance for next day and continue addin up as shown in the example below:

 

Jess90_0-1668205164648.png

Any ideas?

 

Thanks in advance. 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Agree with @ppm1 , You need something like

 

Starting Balanace = calculate(Sum(Table[Sale])- Sum(Table[Cost]), filter(all(Date), Date[Date] < Max(Date[Date]) ) )

 

Power BI Inventory On Hand
Power BI Inventory On Hand: https://youtu.be/nKbJ9Cpb-Aw

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

v-jialluo-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please follow these steps:

(1) Create a new measure

Balance = 
SUMX (
    FILTER ( ALL ( 'Table' ), 'Table'[Data] <= MAX ( 'Table'[Data] ) ),
    'Table'[Sales] - 'Table'[Cost]
)

(2)Final output

vjialluomsft_0-1668663766059.png

 

Best Regards,

Gallen Luo

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
marbi
Helper I
Helper I

Have you solved this? I'm looking for the same DAX to be used

v-jialluo-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please follow these steps:

(1) Create a new measure

Balance = 
SUMX (
    FILTER ( ALL ( 'Table' ), 'Table'[Data] <= MAX ( 'Table'[Data] ) ),
    'Table'[Sales] - 'Table'[Cost]
)

(2)Final output

vjialluomsft_0-1668663766059.png

 

Best Regards,

Gallen Luo

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Agree with @ppm1 , You need something like

 

Starting Balanace = calculate(Sum(Table[Sale])- Sum(Table[Cost]), filter(all(Date), Date[Date] < Max(Date[Date]) ) )

 

Power BI Inventory On Hand
Power BI Inventory On Hand: https://youtu.be/nKbJ9Cpb-Aw

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
ppm1
Solution Sage
Solution Sage

You can't really do true recursion in DAX, but fortunately in your case it looks like you could do a running total of Sales and subtract the running total of costs (both up until the previous day).

 

Pat

Microsoft Employee

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.