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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Rate
Helper III
Helper III

Starting Balance based on Date Slicer

Hello,

 

I am having trouble with using a date slicer to calculate starting balance for a cash balance.

 

So, I want to have a date filter that will allow me to calculate a dinamic starting and end balance.

- Starting balance is calculated as Movements in period previous to the Start Date (Date From).

- End balance is calculated as Starting balance + movements in between selected period.

 

The date slicer will ideally be a range (Date From to Date To), where, if I change the start date, my opening balance will increase/decrease.

 

I include below a simple table and the expected results, in case it helps with understanding what I would love to achieve.

DateValue
01/01/201950
01/06/2019100
31/12/2019-20

 

Based on these values, some calculated examples will be:

Start date: 05/01/2019. End date: 30/06/2020.

Starting Balance: 50

Movements: +80

End Balance: 130

 

Start date: 01/09/2019. End date: 30/06/2020.

Starting Balance: 150

Movements: -20

End Balance: 130

 

Do you have any guidance I could use?

 

Thanks a lot!!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ok we can do this with 3 measures.  I've made some assumptions, such as that you have a date table.

Movements = SUM('YourData'[Value])
Start Balance = var StartDate = FIRSTDATE('Date Table'[Date])
var output = CALCULATE(
	[Movements],
	ALL('YourData'),
	'YourData'[Date] < StartDate
)
RETURN
output
End Balance = var movements = [Movements]
var startBalance = [Start Balance]
RETURN
startBalance + movements

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

You make sure you have date calendar. End balance is nothing but cumulative

 

Starting value = 
var _min =minx(Table,Table[date]))
CALCULATE(SUM(Table[value]),filter(date,date[date] <=_min)


Cumm value = CALCULATE(SUM(Table[value]),filter(date,date[date] <=maxx(date,date[date])))

Cumm value = CALCULATE(SUM(Table[value]),filter(date,date[date] <=maxx(date,endofmonth(dateadd(date[date]),-1,month))))

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Appreciate your Kudos.

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
Anonymous
Not applicable

Ok we can do this with 3 measures.  I've made some assumptions, such as that you have a date table.

Movements = SUM('YourData'[Value])
Start Balance = var StartDate = FIRSTDATE('Date Table'[Date])
var output = CALCULATE(
	[Movements],
	ALL('YourData'),
	'YourData'[Date] < StartDate
)
RETURN
output
End Balance = var movements = [Movements]
var startBalance = [Start Balance]
RETURN
startBalance + movements

 

Hello @Anonymous , that worked great!

Thanks a lot!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.