Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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])
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 33 | |
| 33 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 67 | |
| 45 | |
| 30 | |
| 26 |