Forum Discussion
char23
Helper II
2 years agoSearching for deleted rows in the same table
Hello, I am trying to mark any item that is not found earlier in the table as "Deleted " , but I want to ignore any data with value 3 or greater in my [entry] column. I am trying to add the [Deleted IDs] column below in green, but only want to label "deleted" to those with entry 2 if not found in group with entry 1. Thank you for any help on this!
| ID | ENTRY | Deleted IDs |
| A | 3 | |
| B | 3 | |
| C | 3 | |
| D | 3 | |
| E | 3 | |
| A | 2 | |
| B | 2 | |
| C | 2 | Deleted |
| D | 2 | |
| A | 1 | |
| B | 1 | |
| D | 1 |
This is what I have so far, but I am only getting blank returned in the entire column. But in my table, I definetly have rows present with entry 2, but deleted from entry 1.
Deleted Previous Tasks =
VAR _id = 'Table'[Id]
VAR _entry = 'Table'[Entry]
VAR _table = SELECTCOLUMNS(FILTER('Table', 'Table'[Entry] = _entry - 1), "_id", 'Table'[Id])
VAR _result =
SWITCH( TRUE(),
_entry > 2, BLANK(),
_entry = 1, BLANK(),
_id IN _table, BLANK(),
"Deleted"
)
RETURN
_result
Try this measure
Deleted IDs = VAR _currentID = 'Table'[ID] VAR _currentEntry = 'Table'[ENTRY] VAR _isDeleted = IF( _currentEntry = 2 && NOT ( CALCULATE( COUNTROWS('Table'), FILTER( 'Table', 'Table'[ID] = _currentID && 'Table'[ENTRY] = 1 ) ) > 0 ), "Deleted", BLANK() ) RETURN IF(_currentEntry >= 3, BLANK(), _isDeleted)
1 Reply
- aduguid
Memorable Member
Try this measure
Deleted IDs = VAR _currentID = 'Table'[ID] VAR _currentEntry = 'Table'[ENTRY] VAR _isDeleted = IF( _currentEntry = 2 && NOT ( CALCULATE( COUNTROWS('Table'), FILTER( 'Table', 'Table'[ID] = _currentID && 'Table'[ENTRY] = 1 ) ) > 0 ), "Deleted", BLANK() ) RETURN IF(_currentEntry >= 3, BLANK(), _isDeleted)