Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi
I've got two tables named Procurement and Stock.
Procurement contains columns "Confirmed delivery date" and "Procurement Amount".
Stock contains columns "Available stock", which is a current fixed amount. The tables are related based on "SKU" which is a part of both tables.
So right now i've got a matrix table looking like this:
Product Procurement Amount Available Stock
SKU1 718 -377
16. april 2021 268 -377
14. may 2021 151 -377
24. june 2021 149 -377
4. july 2021 150 -377
I want to create a column stating the available stock after the procurement amount and thereby being capable of possibly creating a date table where "New available stock" > 0 in order to show the next date that entails available stock. So essentially something like:
Product Procurement Amount Available Stock New Available Stock
SKU1 718 -377
16. april 2021 268 -377 -109
14. may 2021 151 -377 42(-109+151)
24. june 2021 149 -377 191(42+149)
4. july 2021 150 -377 341(191+150)
And afterwards create a table visual stating next available stock date = 14. may 2021.
Hope you can help.
Hello @Anonymous ,
Well, from the examples you've provided here is what can be concluded:
Is this what you want to achive?
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Another approach is just sum all the previous Procurement Amount values from the start until the current one. In this case you can use DAX:
Result =
var firstDateValue = MIN(Table[Date])
var currentDate = Table[Date]
var constant = -377
var valueOnFirstDate = CALCULATE(MAX(Table[ProcurementAmount]) + constant, FILTER(Table, Table[Date] = firstDateValue))
var sumValue = CALCULATE(SUM(Table[ProcurementAmount]), FILTER(Table, Table[Date] <= currentDate))
var result = IF(Table[Date] = firstDateValue, valueOnFirstDate, constant + sumValue)
return
result
Did I answer your question? Mark my post as a solution!
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
If you want to have a Calculated DAX column that uses the previous row's calculated value as an input, thenDAX won't help you as DAX cannot do recursion. You can read the explanation here: Refer to previous row of same column.
Power Query instead can be used to achieve the result.
Here is the code that might help (it might be not the most elegant one, but it works):
#"Added Index" = Table.AddIndexColumn(#"Previous step", "Index", 1, 1, Int64.Type),
#"Added CalcStep1" = Table.AddColumn(#"Added Index", "CalcStep1", each if [Index] = 1 then -377 + [ProcurementAmount] else [ProcurementAmount]),
#"Added Column" = Table.AddColumn(#"Added CalcStep1", "Result", each List.Accumulate(List.Range(#"Added CalcStep1"[CalcStep1],0,[Index]),0,(state,current)=> state+current)),
#"Removed Columns" = Table.RemoveColumns(#"Added Column",{"Index", "CalcStep1"})
The idea here was to create an Index column, get the list of Procurement Amount values with the first element changed by constant and then calculate the result. Transitional columns may be deleted afterwards.
In a table visual any filter can be used further (like Result >0, etc.).
Did I answer your question? Mark my post as a solution!
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Hey @Anonymous ,
when you have a column with the procurement amount and no other column, then it's hard to calculate the new amount. Do you have another column that shows the consumption of the product in the time frame?
I also don't know what I should do with the column "Available Stock". You write -377 every row but I don't see that you really use that column.
Could you explain your columns a little better?
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
12 | |
10 | |
10 | |
6 |