Forum Discussion

Roym's avatar
Roym
Icon for Helper IV rankHelper IV
4 years ago
Solved

If no previous row then

I have the below code who shows  in column the results based on the following logic:   1. If the test is effective, and the review is also effective -> Column= Effective 2. If test is effective, a...
  • ryan_mayu's avatar
    4 years ago

    Roym 

    maybe you can try this

    Column =
    var _previosid=MAXX(filter('Table','Table'[session]=EARLIER('Table'[session])&& 'Table'[ID]< EARLIER('Table'[ID])),'Table'[ID])
    var _review=CALCULATE(MAX('Table'[Review]),FILTER('Table','Table'[ID]=_previosid))
    VAR _result=
    SWITCH(TRUE(),'Table'[Test]="Effective" && 'Table'[Review]="Effective","Effective",
    'Table'[Test]="Effective" && 'Table'[Review]="Ineffective","Ineffective",
    'Table'[Test]="Effective" && 'Table'[Review]="Open",_review)

    return if (_result="","test result",_result)