Forum Discussion
ricardo9
1 year agoNew Member
Cumulative that reset
Hey everyone, I need to sum a cumulative way that will stop at some point and reset the sum: Example: Product idorder repeat new column * Product A 1 ...
- 1 year ago
Kaviraj11
1 year agoSolution Sage
Hi,
Here’s the DAX formula you can use:
NewColumn =
VAR CurrentProduct = m[Product]
VAR CurrentOrder = m[idorder]
VAR PreviousOrder =
CALCULATE(
MAX(m[idorder]),
FILTER(
m,
m[Product] = CurrentProduct && m[idorder] < CurrentOrder
)
)
VAR PreviousValue =
CALCULATE(
MAX(m[NewColumn]),
FILTER(
m,
m[Product] = CurrentProduct && m[idorder] = PreviousOrder
)
)
RETURN
IF(
ISBLANK(PreviousOrder),
0,
IF(
ISBLANK(PreviousValue),
1,
PreviousValue + 1
)
)
- ricardo91 year agoNew Member
it doesn't work the New Column does not exist yet so the MAX can't have it, i'm trying to create this new column