Forum Discussion
Calculating a Cumulative Sum in Power BI
A running total of inventory on hand is effectively what I interpret you to mean you need. In this table, you're describing things by date. Without a time stamp, you could have several ways this gets interpreted. for example:
615
-50
+20
+10
+10
+10
which is effectively in the order you have the sample listed. However, you could just as easily have:
615
+20
+10
+10
-50
as all the +/- are happening on the same day.
So since the query is going to really not have any row level associations, you have to determine if your input data is in sequential order on purpose, and if that is the case, then I would build a solution that adds in a column which is simply a sequential number counter based on the row. This is done in lots of cases as an "ID" type column. Then when you build out the chart, you can have the matrix, or graph or whatever, sort by the "ID" column and you preserve order of the data you loaded.
If order of data isn't from what you loaded, then I would go by date column (adding time stamp if you want your inbound to get added to your running inventory total before outbound gets deducted, etc.)
hope this helps.