Forum Discussion

Carlend's avatar
Carlend
Frequent Visitor
4 years ago
Solved

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...
  • Icey's avatar
    4 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.