Forum Discussion

Analitika's avatar
Analitika
Icon for Post Prodigy rankPost Prodigy
4 years ago
Solved

Difference calculation per different rows in table in Power BI

Hello,   I would like to ask how to calculate difference between values per different rows in same table. I have this data: I expect getting result something like this. We are having additi...
  • amitchandak's avatar
    amitchandak
    4 years ago

    Analitika , Please find the attached file

     

    one of the two

     

    Calc 1 =
    var _1 = maxx(FILTER('Table', [ID] =EARLIER('Table'[ID]) && [CRE]<>0) ,[CRE])
    return if([DET] <>0, _1 -[DET])


    Calc 12 =
    var _1 = maxx(FILTER('Table', [ID] =EARLIER('Table'[ID]) && [CRE]<>0 && [DATE] >EARLIER('Table'[DATE]) ) ,[CRE])
    return if([DET] <>0, _1 -[DET])