Forum Discussion
francoisl
2 years agoHelper II
Get Info from Previous Row (Again)
It seems I cannot get my head around this. I looked at most posts on the same subject but I cannot create the proper column. Here's a sample data (table name = invtrx) warehouse item ...
- 2 years ago
francoisl Assuming you want a calculated column and assuming you have an index, you could do this as a new calculated column:
Calculated Column = VAR __Flag = [flag] VAR __Warehouse = [warehouse] VAR __Item = [item] VAR __Date = [date] VAR __Index = [index] VAR __Result = IF( __Flag <> BLANK(), __Flag, VAR __Previous = MAXX( FILTER( 'Table', [warehouse] = __Warehouse && [item] = __Item && [date] < __Date && [flag] <> BLANK() ), [index]) VAR __Result = MAXX( FILTER( 'Table', [index] = __Previous), [flag] ) RETURN __Result ) RETURN __Result
Greg_Deckler
2 years agoCommunity Champion
francoisl Assuming you want a calculated column and assuming you have an index, you could do this as a new calculated column:
Calculated Column =
VAR __Flag = [flag]
VAR __Warehouse = [warehouse]
VAR __Item = [item]
VAR __Date = [date]
VAR __Index = [index]
VAR __Result =
IF(
__Flag <> BLANK(),
__Flag,
VAR __Previous = MAXX( FILTER( 'Table', [warehouse] = __Warehouse && [item] = __Item && [date] < __Date && [flag] <> BLANK() ), [index])
VAR __Result = MAXX( FILTER( 'Table', [index] = __Previous), [flag] )
RETURN
__Result
)
RETURN
__Result
- francoisl2 years agoHelper II