We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. 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])
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 57 | |
| 40 | |
| 36 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 38 | |
| 34 | |
| 23 |