Forum Discussion
Rate
Helper III
6 years agoStarting 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 e...
- Anonymous6 years ago
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 outputEnd Balance = var movements = [Movements] var startBalance = [Start Balance] RETURN startBalance + movements
amitchandak
Super User
6 years agoYou 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.