- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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 0
Product B 1 0
Product A 2 1 1
Product A 3 1 2
Product C 3 0
Product C 4 1 1
Product A 5 0
Product A 6 1 1
So if the same products repeat in the next id order it wil give 1 and if repeats again 2... But if the next one the product is not there and repeats again, the cumulative will reset and start over.
I try this one but only generetas cumulative by the sequence, i don't know how to reset:
CALCULATE(sum(m[repeat]),FILTER(m,m[product]=EARLIER(m[product])),m[idorder] <=EARLIER(m[idorder]))
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

So if the same products repeat in the next id order
That's too vague. Did you mean to say "if any product repeats across orders"? What if order 2 had product C as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

it can't, the id order doesn't repeat the product
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

not correct, i need to create New Column* that i put there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

as I said, the requirement is too vague. What if Product C is part of idOrder 2 ? What would be the expected result?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

As i said it wont happen because de order does not accept the same product
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I don't know what that means. Both orders 1 and 3 have two products. why can order 2 not have two products?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Just can't be the same product, a order can have a lot of products
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

What is the expected outcome for
Product idorder
Product A | 1 |
Product B | 1 |
Product A | 2 |
Product C | 2 |
Product A | 3 |
Product C | 3 |
Product C | 4 |
Product A | 5 |
Product A | 6 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Product idorder New column
Product A 1 0
Product B 1 0
Product A 2 1
Product C 2 0
Product A 3 2
Product C 3 1
Product C 4 2
Product A 5 0
Product A 6 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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
)
)
Proud to be a Super User! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
01-09-2025 07:25 AM | |||
03-02-2025 10:36 PM | |||
10-15-2024 01:43 PM | |||
Anonymous
| 03-26-2020 03:11 PM | ||
12-27-2024 12:38 AM |
User | Count |
---|---|
89 | |
82 | |
54 | |
40 | |
35 |