Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Daily Closing Balance

  I am trying to visualise bank balance trend, i am facing error while trying to create powerbi dax for this. My data is in the following table format: Date,closing_balance,bank_name 2023-05-25 ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    I suggest you to create a calendar table and inactive the relationship between two tables.

    Measure:

    Balance Measure = 
    VAR _Date =
        CALCULATE (
            MAX ( 'Calendar'[Date] ),
            FILTER (
                ALL ( 'Calendar' ),
                'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
                    && CALCULATE (
                        SUM ( Bank[closing_balance] ),
                        USERELATIONSHIP ( Bank[transaction_date], 'Calendar'[Date] )
                    )
                        <> BLANK ()
            )
        )
    RETURN
        CALCULATE (
            SUM ( Bank[closing_balance] ),
            FILTER ( Bank, Bank[transaction_date] = _Date )
        )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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