Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
5 years ago
Solved

Accumulated Balance

Hello I'm trying to calculate a balance that gives me the summation of an account in a period, The fields I have are the transid (seat number), the line_id (line number), what I'm looking for is to...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Don't @Syndicate_Admin,

    Because the date is not unique, you cannot use the Date column for accrual in the FILTER function. You must add an index column in Power Query.

    Before you add an index column, you must ensure that the date column is sorted from small to large and that the Balance column is also sorted from small to large, so that the result is as desired.

    18.png19.png20.png

    Tips: I cannot enter the PBIX file that you provided to add index columns in Power Query, so I exported the data and recreated a PBIX file.

    So the measure is

    Saldo_acum = CALCULATE(SUM('Sheet1'[Saldo]),FILTER(ALLEXCEPT('Sheet1',Sheet1[Account],Sheet1[BPLId]),[Index]<=MAX('Sheet1'[Index])))

    21.png

    You can check more details from here.

    Best regards

    Stephen Tao

    If this post helps,then consider Accepting it as the solution to help other members find it faster.