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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
MP-iCONN
Resolver I
Resolver I

Rolling Sum of a quantity plus another value

Ok hopefully I explain this well.  I have a matrix table setup with 3 columns so far.  I have it broken down by Item ID and Month/Year.

 

For each month we have adds and uses on the Item ID.  Basically the Adds are incoming stock from Purchase Orders and the Uses are what will go out via our Work Orders/Sales Orders.  I then subtract the Adds from the Uses to get the Net column.

 

What I need to do then is take the current Item On Hand Qty and do a rolling Sum of each Net row.  So lets say for Item 9DZ-88 I have a current On Hand Qty of 76,980 then Add it to the May 2023 Net which is 3,220 and arrive at 80,200 then Jun 2023 Net which is 5,800 and arrive at 86,000.  See Example set below.

Item ID 9DZ-88 has a starting On Hand Qty of 76,980:

 

MPiCONN_0-1684518032790.png

 

Any help is  greatly appreciated and just trying to see the best way to arrive at the current On Hand Qty after each month.

 

Thank you.

1 ACCEPTED SOLUTION

I looked at various articles before and after posting my question and believe I was able to figure it out.

 

I created a measure to solve this.  These values all come from different tables which are all related by the Item ID.  I also created a DateTable to help with the relationships between all the table dates.

 

Month End =
CALCULATE(
    SUM(ItemCase[OnHandQty])+[Net],
    FILTER(
        ALLSELECTED(DateTable[Dates]),
        ISONORAFTER(DateTable[Dates],MAX(DateTable[Dates]), DESC)
    )
)

 

MPiCONN_0-1684528846423.png

 

The numbers all seem to add up correct for the few that I checked so far.

 

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@MP-iCONN This has a recursive element to it so generally it would not be possible to do what you want. However, in this case there may be a way around it. So, what you could do is create a measure (or possibly a column) where would would grabe all previous rows for that item and add up the Net for those rows and tack that onto your original starting quantity. Not super efficient but better than not possible. If you can share sample data as text can probably mock it up.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I looked at various articles before and after posting my question and believe I was able to figure it out.

 

I created a measure to solve this.  These values all come from different tables which are all related by the Item ID.  I also created a DateTable to help with the relationships between all the table dates.

 

Month End =
CALCULATE(
    SUM(ItemCase[OnHandQty])+[Net],
    FILTER(
        ALLSELECTED(DateTable[Dates]),
        ISONORAFTER(DateTable[Dates],MAX(DateTable[Dates]), DESC)
    )
)

 

MPiCONN_0-1684528846423.png

 

The numbers all seem to add up correct for the few that I checked so far.

 

Thank you, @MP-iCONN, it works great!

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