Forum Discussion
Mickey123
1 year agoRegular Visitor
Count the changes made on fields in a order compare to previous value in the same order.
I have a requirement to get the count of the manual changes users made on the given fields.Order co , Order#, Ordertype and Line # are unique. Here is the data set. Can someone advise me on how to code to get these values?
| Order Co | Order Number | Or Ty | Line Number | Request Date | Item | Price | User ID | Date Change count | Part change | Price change | |
| 100 | 1003 | SN | 1 | 4/4/2024 | A204 | 10 | JACK | 0 | 0 | 0 | |
| 100 | 1003 | SN | 1 | 4/10/2024 | A205 | 12 | PDAVIS | 1 | 1 | 1 | |
| 100 | 1004 | SN | 1 | 4/4/2024 | A145 | 15 | JACK | 0 | 0 | 0 | |
| 100 | 1004 | SN | 1 | 4/12/2024 | A145 | 15 | AMLY | 1 | 0 | 0 | |
| 100 | 1005 | SN | 1 | 4/30/2024 | A999 | 80 | JACK | 0 | 0 | 0 | |
| 100 | 1005 | SN | 1 | 4/30/2024 | A999 | 80 | AMLY | 0 | 0 | 0 | |
| 100 | 1005 | SN | 2 | 4/30/2024 | A997 | 92 | JACK | 0 | 0 | 0 | |
| 100 | 1005 | SN | 2 | 5/12/2024 | A998 | 95 | AMLY | 1 | 1 | 1 |
I will suggest to use column and not a measure for this.
Tip: Best is to get in the power query than using DAX!Dax Column syntax (and not measure syntax): For some reason it is not allowing to provide the DAX here, please check below as the reply :-)Row Index By Group = ROWNUMBER( ALLSELECTED(tbl[Order Co], tbl[Order Number], tbl[Or Ty], tbl[Line Number], tbl[Item], tbl[Request Date]), ORDERBY( tbl[Item], ASC, tbl[Request Date], ASC), PARTITIONBY(tbl[Order Co], tbl[Order Number], tbl[Or Ty], tbl[Line Number])) - 1