Forum Discussion

STS_Joshua's avatar
STS_Joshua
Helper II
5 years ago
Solved

Summing forward and backwards

Hi All, I have a current on hand amount and monthly ins and outs. Here is some sample data: Date In Out Fin Aug 6 4   Sep 3 5   Oct 4 5   Nov 5 2   Dec 4 3   ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi STS_Joshua ,

    Please try to create a measure as below:

    Fin =
    IF (
        MAX ( 'Date'[Date] ) = DATE ( 2019, 8, 1 ), //Start date: 2019/08/01
        12, //Initial Fin: 12
        12
            + CALCULATE (
                SUM ( 'Inputs'[Ins] ),
                FILTER (
                    'Inputs',
                    'Inputs'[Date] <= MAX ( 'Date'[Date] )
                        && 'Inputs'[Date] > DATE ( 2019, 8, 1 )
                )
            )
            - CALCULATE (
                SUM ( 'Outputs'[Outs] ),
                FILTER (
                    'Outputs',
                    'Outputs'[Date] <= MAX ( 'Date'[Date] )
                        && 'Outputs'[Date] > DATE ( 2019, 8, 1 )
                )
            )
    )

    If the above measure can't get your desired result, please provide some sample data of table Inputs and Outputs and your desired result with example. Thank you.

    Best Regards
    Community Support Team _ Rena Ruan
    If this post helps, then please consider Accept it as the solution to help the other members find it more.