Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi guys,
i have a running total of a sales column. This running total shall start to cumulate sales from 0 after the columnes where the reset column is 1. The whole cumulation should be done by group for the SKU column:
Here the example with the yellow colum as output target:
Anybody any i dea?
Thanks in advance!
Solved! Go to Solution.
I gave you the measure version. Here is the modified version that should work in a calculated column.
RT Since Reset =
VAR thisdate = Reset[Date]
VAR thissku = Reset[SKU]
VAR lastresetdate =
CALCULATE (
MAX ( Reset[Date] ),
ALL(Reset),
Reset[SKU] = thissku,
Reset[Date] <= thisdate,
Reset[Reset] = 1
)
VAR result =
CALCULATE (
SUM ( Reset[Sales] ),
ALL ( Reset ),
Reset[SKU] = thissku,
FILTER (
ALL ( Reset[Date] ),
Reset[Date] >= lastresetdate
&& Reset[Date] <= thisdate
)
)
RETURN
result
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi, @Anonymous
Please try the below for creating a new column.
Sales Cumulate Reset CC =
VAR resetcumulate =
CALCULATE (
SUM ( 'Table'[Reset] ),
FILTER (
'Table',
EARLIER ( 'Table'[Date] ) >= 'Table'[Date]
&& EARLIER ( 'Table'[SKU] ) = 'Table'[SKU]
)
)
VAR currentdate = 'Table'[Date]
VAR resetcumulatetable =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( 'Table', 'Table'[Date], 'Table'[SKU], 'Table'[Sales] ),
"@resetgroup",
CALCULATE (
SUM ( 'Table'[Reset] ),
FILTER (
'Table',
EARLIER ( 'Table'[Date] ) >= 'Table'[Date]
&& EARLIER ( 'Table'[SKU] ) = 'Table'[SKU]
)
)
),
[@resetgroup] = resetcumulate
&& 'Table'[Date] <= currentdate
&& EARLIER ( 'Table'[SKU] ) = 'Table'[SKU]
)
RETURN
SUMX ( resetcumulatetable, 'Table'[Sales] )
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
@Anonymous just curious how come row 6 and 11 has a value of 2, isn't it should be 1 since it is reset at the previous date?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Here is one measure expression that returns your desired results.
RT Since Reset =
VAR thisdate =
MAX ( Reset[Date] )
VAR thissku =
MIN ( Reset[SKU] )
VAR lastresetdate =
CALCULATE (
MAX ( Reset[Date] ),
ALL ( Reset ),
Reset[SKU] = thissku,
Reset[Date] <= thisdate,
Reset[Reset] = 1
)
VAR result =
CALCULATE (
SUM ( Reset[Sales] ),
ALL ( Reset ),
Reset[SKU] = thissku,
FILTER (
ALL ( Reset[Date] ),
Reset[Date] >= lastresetdate
&& Reset[Date] <= thisdate
)
)
RETURN
result
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@mahoneypat thank you for the quick reply. But the query gives the same value in al columns.
I gave you the measure version. Here is the modified version that should work in a calculated column.
RT Since Reset =
VAR thisdate = Reset[Date]
VAR thissku = Reset[SKU]
VAR lastresetdate =
CALCULATE (
MAX ( Reset[Date] ),
ALL(Reset),
Reset[SKU] = thissku,
Reset[Date] <= thisdate,
Reset[Reset] = 1
)
VAR result =
CALCULATE (
SUM ( Reset[Sales] ),
ALL ( Reset ),
Reset[SKU] = thissku,
FILTER (
ALL ( Reset[Date] ),
Reset[Date] >= lastresetdate
&& Reset[Date] <= thisdate
)
)
RETURN
result
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 40 | |
| 37 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 85 | |
| 69 | |
| 37 | |
| 28 | |
| 27 |