Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
STS_Joshua
Helper II
Helper II

Summing forward and backwards

Hi All,

I have a current on hand amount and monthly ins and outs. Here is some sample data:

DateInOutFin
Aug64 
Sep35 
Oct45 
Nov52 
Dec43 

 

Assuming an on hand at the end of september of 10 then I would like a measure that will calculate forward and backwards like so:

 

DateInOutFin
Aug6412
Sep3510
Oct459
Nov5212
Dec43

13

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

 

 

View solution in original post

3 REPLIES 3
FrankAT
Community Champion
Community Champion

Hi @STS_Joshua 

I don't know where your the start value of 10 is coming from . So I integrated it with the following solution:

 

27-10-_2020_22-48-58.png

 

Fin = 
CALCULATE(
    [Sum of Value],
    FILTER(
        ALL('Table'),
        'Table'[Index] <= MIN('Table'[Index])
    )
)

Sum of Value = SUM('Table'[In]) - SUM('Table'[Out])

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Apologies, I should have been more explicit. 10 would be the value to start October with therefore it should be the final value for September. All of the month values are measures which are sums from their own respective tables like so:

Ins = SUM('Inputs'[Ins])

Outs = SUM('Outputs'[Outs])

 

The dates are a date table setup like so:

Dates = CALENDAR(FIRSTDATE('Inputs'[date]),LASTDATE('Inputs'[date]))

 

Final would then be a measure taking into account the Ins, Outs, and Current Inventory level that then works forward and back from the current Inventory because I have historical/projected ins and outs in their own respective tables. 

Anonymous
Not applicable

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.

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors