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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
power2
Frequent Visitor

Calculating Past and Future Inventory Value based on today's inventory value

Hello everyone,

 

I built a power bi report that can show the inventory value now. And it can also show what was received each day and what was processed. So, let's say today's inventory value is $100,000 and we received $10,000 and processed $20,000 today so that would mean our inventory was $110,000 yesterday right!

I want to create a system where it will back track and find the inventry value of each day in the last 10 months and it will also start calculating it from now on in the future. All this will be based off of today's inventory value.

 

Any help?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @power2 ,

You can follow the steps below to get it, please find the details in the attachment.

1. Add index column in Power Query Editor

= Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)

vyiruanmsft_1-1712645243439.png

2. Create a calculated column as below

Expected Column = 
VAR _inventory =
    CALCULATE ( SUM ( 'Table'[Inventory Value] ), ALL ( 'Table' ) )
RETURN
    CALCULATE (
        _inventory + SUM ( 'Table'[OUT] )
            - SUM ( 'Table'[IN] ),
        FILTER ( 'Table', 'Table'[Index] <= EARLIER ( 'Table'[Index] ) - 1 )
    )

vyiruanmsft_0-1712645188518.png

Best Regards

View solution in original post

2 REPLIES 2
power2
Frequent Visitor

power2_0-1712599203929.png


Here is a visual representation of what I am looking for. Obviolusy, if I did this on excel, I would just drag up and it would fill in the value based on the easy logic that I did (Current Value - In + Out)

I need to implement this in Power Bi with a DAX code.

Anonymous
Not applicable

Hi @power2 ,

You can follow the steps below to get it, please find the details in the attachment.

1. Add index column in Power Query Editor

= Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)

vyiruanmsft_1-1712645243439.png

2. Create a calculated column as below

Expected Column = 
VAR _inventory =
    CALCULATE ( SUM ( 'Table'[Inventory Value] ), ALL ( 'Table' ) )
RETURN
    CALCULATE (
        _inventory + SUM ( 'Table'[OUT] )
            - SUM ( 'Table'[IN] ),
        FILTER ( 'Table', 'Table'[Index] <= EARLIER ( 'Table'[Index] ) - 1 )
    )

vyiruanmsft_0-1712645188518.png

Best Regards

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors