Forum Discussion
Priya24
2 years agoNew Member
Need Help with Cumulative Total Calculation Based on Selected Periods
Hello Power BI Community, I'm working on a table visual in Power BI that displays an opening balance column. I've set up a period slicer ranging from 1 to 12. Currently, when I select multiple pe...
Legend_11
2 years agoResolver I
CumulativeSalesUpToPreviousPeriod =
VAR LowestSelectedPeriod = MIN('PeriodTable'[PeriodNumber])
VAR PreviousPeriod = LowestSelectedPeriod - 1
VAR CumulativeTotalUpToPreviousPeriod =
CALCULATE(
SUM('YourTable'[Sales]),
FILTER(
ALL('PeriodTable'),
'PeriodTable'[PeriodNumber] <= PreviousPeriod
)
)
RETURN
IF(PreviousPeriod > 0, CumulativeTotalUpToPreviousPeriod, 0)