Forum Discussion
Anonymous
4 years agoNot applicable
Track changes in Rows, post a value when occurs
Hi,
I want to track when a new Variant is being registered/produced in my dataset in the column changeover
My table looks similar to this
| ID | VARIANT | Changeover |
| 1 | A | |
| 2 | A | 1 |
| 3 | A | 1 |
| 4 | B | 0 |
| 5 | B | 1 |
| 6 | B | 1 |
| 7 | C | 0 |
Basically everytime that the previous row is not matching the next row, post changeover or 1 or 0 (W/E)
Blue equals desired state and is what i want to achieve
Hope someone can help
BR
Kristian
- Anonymous4 years ago
I solved it like this
Match =VAR __prevRow = CALCULATE( MAX( 'Table'[ID] ) ) - 1VAR __PrevRowValue = CALCULATE( MAX( 'Table'[VAR] ), 'Table'[ID] = __prevRow )VAR __currRowValue = CALCULATE( MAX( 'Table'[VAR] ) )RETURNIF( __currRowValue = __PrevRowValue, 0, 1 )
3 Replies
- amitchandak
Super User
Anonymous , Create a new column like
new column =
var _max= Maxx(filter(Table, [ID] = earlier([ID])-1 ), [VARIANT])
return
if(_max =[VARIANT] ,1,0)- AnonymousNot applicable
I solved it like this
Match =VAR __prevRow = CALCULATE( MAX( 'Table'[ID] ) ) - 1VAR __PrevRowValue = CALCULATE( MAX( 'Table'[VAR] ), 'Table'[ID] = __prevRow )VAR __currRowValue = CALCULATE( MAX( 'Table'[VAR] ) )RETURNIF( __currRowValue = __PrevRowValue, 0, 1 )
- AnonymousNot applicable