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

Cumulative finance leases total DAX help

Objective:

1. To calculate the Running total, such that when I select a specific month from a slicer, the measure would give me the running total sum for that month. In the dataset, the correct defination of running total is the sum of balance starting from 0 till the number of month (1= Jan, 2= Feb and so on...) 

2. To make the measure dynamic, i.e when the yearly books close and an opening balance is created

 

Measure & Columns

[Finance Leases]: Sum of GL account balance.

gltrsn[dtrs]= date of transaction. Using this for slicer time intelligence.

gltrsn[cpdno]= period number, values as 0,1,2,3... 12. 0 represents the opening balance (i.e balance on cpdno =0 and dtrs = last day of the year.

 

Current dax i'm using is

 

Cumilative Finance Leases=

VAR _fromdate = DATE(2021,12,31)
Return
CALCULATE(
[Finance Leases],
DATESBETWEEN(GL_TRNS[dtrs],_fromdate,MAX(GL_TRNS[dtrs])))
 
raghavk_0-1651030914978.png

 

I tried using an updated version, which would be dynamic, but it includes the balance as on December 31st 2021, where cpdno=12

Cumilative Finance Leases =

VAR _fromdate = DATE(Year(TODAY()-1),12,31)

Return

CALCULATE(
[Finance Leases],
DATESBETWEEN(GL_TRNS[dtrs],_fromdate,MAX(GL_TRNS[dtrs])))
 
 
PLEASE HELP !!! 
1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , refer to my example, Max of date to the selected date in date table, Prefer date table

 

Switch Period =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = Minx(ALLSELECTED('Date'),'Date'[Date])
return
CALCULATE([Finance Leases] ,DATESBETWEEN('Date'[Date],_min,_max))

 

refer

https://medium.com/chandakamit/power-bi-when-i-felt-lazy-and-i-needed-too-many-measures-ed8de20d9f79

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

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.