Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I'm trying to add a column to the table below to calculate the 'Next ID', based on 'Last ID' and where 'Mins' is not 0, with a reset at each Product change.
Any help with this would be appreciated..
Current:
| Product | Last ID | Mins |
| Prod1 | 105 | 10 |
| Prod1 | 205 | 20 |
| Prod1 | 305 | 0 |
| Prod1 | 405 | 15 |
| Prod1 | 505 | 0 |
| Prod1 | 605 | 20 |
| Prod2 | 105 | 10 |
| Prod2 | 205 | 0 |
| Prod2 | 305 | 0 |
| Prod2 | 405 | 30 |
| Prod2 | 505 | 0 |
| Prod2 | 605 | 20 |
| Prod3 | 105 | 10 |
| Prod3 | 205 | 0 |
| Prod3 | 305 | 0 |
| Prod3 | 405 | 25 |
| Prod3 | 505 | 10 |
| Prod3 | 605 | 0 |
Expected Output:
| Product | Last ID | Mins | Next ID | |
| Prod1 | 105 | 10 | 205 | |
| Prod1 | 205 | 20 | 405 | |
| Prod1 | 305 | 0 | - | |
| Prod1 | 405 | 15 | 605 | |
| Prod1 | 505 | 0 | - | |
| Prod1 | 605 | 20 | - | |
| Prod2 | 105 | 10 | 405 | |
| Prod2 | 205 | 0 | - | |
| Prod2 | 305 | 0 | - | |
| Prod2 | 405 | 30 | 605 | |
| Prod2 | 505 | 0 | - | |
| Prod2 | 605 | 20 | - | |
| Prod3 | 105 | 10 | 405 | |
| Prod3 | 205 | 0 | - | |
| Prod3 | 305 | 0 | - | |
| Prod3 | 405 | 25 | 505 | |
| Prod3 | 505 | 10 | - | |
| Prod3 | 605 | 0 | - |
Thanks,
Jamie.
Solved! Go to Solution.
@aJamie , Create a new column like
minx(filter(Table, [Product] =earlier([Product]) && [Last ID] >earlier([Last ID]) && [Mins] <> 0 ), [Last ID])
Amazing! ..thanks so much for your help. Perfect solution.
@aJamie Try this:
* Make little tweak in @amitchandak DAX like below
@aJamie , Create a new column like
minx(filter(Table, [Product] =earlier([Product]) && [Last ID] >earlier([Last ID]) && [Mins] <> 0 ), [Last ID])
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 33 | |
| 29 | |
| 26 |
| User | Count |
|---|---|
| 134 | |
| 104 | |
| 63 | |
| 60 | |
| 55 |