Forum Discussion
twilbour
4 years agoHelper I
Problem with Running Total
I am creating a general ledger detail report, that shows all the transactions within a department, account and date range. I want a running total measure that starts with the first displayed transac...
Alexrai
4 years agoHelper I
I modified this a little from a similar question, it might help you too:
Add Contributions =
VAR ClientName = MAX(Facts[Name])
VAR CurrentDate = MAX('Date'[Date])
VAR Selected = CALCULATETABLE('Date', ALLSELECTED())
VAR PriorStart = CALCULATE(MIN(Facts[Date]), Facts[Name] = ClientName, Facts[Date]< CurrentDate, REMOVEFILTERS('Date'[Date]))
VAR PriorEnd = CALCULATE(MAX(Facts[Date]), Facts[Name] = ClientName, Facts[Date]< CurrentDate, REMOVEFILTERS('Date'[Date]))
VAR PriorValue = CALCULATE(SUM(Facts[Contribution]), Facts[Name]=ClientName, INTERSECT(DATESBETWEEN(Facts[Date], PriorStart, PriorEnd), Selected), REMOVEFILTERS('Date'[Date]))
VAR CurrentValue = SUM(Facts[Contribution])
VAR NewValue = CurrentValue + PriorValue
RETURN IF(ISBLANK(PriorStart), CurrentValue, NewValue)