Forum Discussion

edgarjb-68's avatar
edgarjb-68
Frequent Visitor
6 years ago
Solved

Row calculation

How to calculate rows on a table in Power BI? I want to create a column "started" as below, for each row of this column I need the result like this excel formula: =IF(AND(A3=A2;B3-B2<1);"No";"yes") ...
  • Anonymous's avatar
    Anonymous
    6 years ago
    Hi ,
    Can you try to change the datediff to minutes and change the less than condition.
    Thanks.
  • edgarjb-68's avatar
    edgarjb-68
    6 years ago

    JUST PERFECT!!!

     

    started = VAR v_LagPart = CALCULATE( MAX( Data[part] ), FILTER( Data, Data[part] = EARLIER( Data[part] ) && Data[installdate] < EARLIER( Data[installdate] ) ) ) VAR v_LagDate = CALCULATE( MAX( Data[installdate] ), FILTER( Data, Data[part] = EARLIER( Data[part] ) && Data[installdate] < EARLIER( Data[installdate] ) ) ) RETURN IF( Data[part] = v_LagPart && ( DATEDIFF( v_LagDate, Data[installdate], MINUTE ) < 1440 ), "No", "Yes" )