Forum Discussion
Carlend
5 years agoFrequent Visitor
Filter based on a value from a previous row
Hi, i have a scenario like: Recipe_Name N_Cicle Test1 2 Test1 2 Test1 1 Test1 0 Test2 3 Test2 3 Test2 2 Test2 1 Test2 0 And i want to filter N_Cicle c...
- 5 years ago
Hi Carlend ,
Can this meet your requirements?
Measure = VAR Count_ = CALCULATE ( COUNT ( 'Table'[N_Cicle] ), ALLEXCEPT ( 'Table', 'Table'[Recipe_Name], 'Table'[N_Cicle] ) ) VAR FirstIndex_ = IF ( Count_ > 1, CALCULATE ( MIN ( 'Table'[Index] ), ALLEXCEPT ( 'Table', 'Table'[Recipe_Name], 'Table'[N_Cicle] ) ), MIN ( 'Table'[Index] ) ) RETURN IF ( MIN ( 'Table'[Index] ) = FirstIndex_, 1 )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Carlend
5 years agoFrequent Visitor
It's not possibile to filter the same table without creating a new one?
VahidDM
Super User
5 years ago
It's possible, add a new column with this code:
New Column =
VAR _M =
CALCULATE (
MIN ( 'Table'[MixTime] ),
FILTER (
'Table',
'Table'[Recipe_Name] = EARLIER ( 'Table'[Recipe_Name] )
&& 'Table'[N_Cicle] = EARLIER ( 'Table'[N_Cicle] )
)
)
RETURN
IF ( [MixTime] > _M, 0, 1 )
then filter that column to show 1.
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!