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
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
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.