Forum Discussion

PBE's avatar
PBE
Helper II
3 years ago
Solved

Use Previous Value In Column In Calculation

Hi, I don't know how to do this in Power BI. Any ideas on how to do this in DAX or Power Query.   I found this not easy to explain so any questions please let me know.   Thanks   Pete   The ...
  • v-jianboli-msft's avatar
    3 years ago

    Hi PBE ,

     

    Please try:

    Excess = SUMX(FILTER('Table',[Row]<=EARLIER('Table'[Row])),[Amount]-[Available])

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-jianboli-msft's avatar
    3 years ago

    Hi PBE ,

     

    Please try:

    Measure = 
    var _a = ALLSELECTED('Table'[Work Type])
    var _b = MAX('Table'[Row])
    return SUMX(FILTER(ALL('Table'),[Work Type] in _a&&[Row]<=_b),'Table'[Amount]-'Table'[Available])

    Output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.