Forum Discussion
Praj8050
1 year agoHelper I
Running Total Calculation Across Multiple Categories
I am currently calculating the running total of units for Category_A using the following formula, but the result is not as expected. When I remove the date filters, the calculation works correctly. H...
Sahir_Maharaj
1 year agoSuper User
Hello Praj8050,
Can you please try the following:
Units Running Total =
CALCULATE(
SUM(df[Units]),
FILTER(
ALLSELECTED(df), -- Ensures that date range selection is respected
df[Sort (Category_A)] <= MAX(df[Sort (Category_A)]) && -- Running total up to the current row in Category_A
df[Category_A] = MAX(df[Category_A]) && -- Maintain context for Category_A
df[Category_B] = MAX(df[Category_B]) -- Maintain context for Category_B in columns
)
)