fix(account_balance_timeline)
diff --git a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py
index 3063606..1788f8c 100644
--- a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py
+++ b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py
@@ -20,10 +20,10 @@
 	account = filters.get("account")
 	company = filters.get("company")
 
-	if not from_date:
-		from_date = get_from_date_from_timespan(to_date, timespan)
 	if not to_date:
 		to_date = nowdate()
+	if not from_date:
+		from_date = get_from_date_from_timespan(to_date, timespan)
 
 	# fetch dates to plot
 	dates = get_dates_from_timegrain(from_date, to_date, timegrain)
@@ -66,8 +66,8 @@
 	# for balance sheet accounts, the totals are cumulative
 	if root_type in ('Asset', 'Liability', 'Equity'):
 		for i, r in enumerate(result):
-			if i < 0:
-				r[1] = r[1] + result[i-1][1]
+			if i > 0:
+				r[i][1] = r[i][1] + result[i-1][1]
 
 	return result