Forum Discussion
Sum/ Max - Calculation based on date [Stock calculation]
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
Hello,
There is link for the .pbix file.Perhaps will be more clear.
https://drive.google.com/file/d/1Nf37G80idnu9JW9ODKtBSOtr1LEQ2uhG/view?usp=sharing
Demands are in the past too [like 01/05/2023] but stock is downloaded every day so i dont need calculate "Current stock" - "Demand" when the stock is from 01/10/2023 but demands are in the past, i just need to take from actual Monday > Future
(understood not screenshot. it will be for just better understanding)
Sum of Stock: have same QTY ( because is downloaded for example: once per week)
Date: is from calendar table and connection with Demand date
Sum of Demand: is calculated like this:
CALCULATE(SUM(
Planning_Material_Delfor[Column]),
FILTER(ALL('Calendar'[Date]),'Calendar'[Date] <=MAX('Calendar'[Date])
)
)Balance stock: Its just measure
Total Stock - Total DemandAll i want is just ignore the past dates and just look only actual and more
(Start calculate from actual week, that was try to use week offset )
Thank you so much
- lbendlin2 years agoSuper User
What's the point of computing Total Stock? Stock is something that only has a meaning for each individual day.
How can Balance Stock be negative? Are you selling things that are not there?
- aoncirto2 years agoFrequent Visitor
In this case, the measure for "total stock" is just there so I can subtract it along with "Total Demand"
This works fine, I need even negative values to know when the material will run out and on what day, the problem is with the calculation I think with "Total demand" when it calculates the first day where it found the value in the demand column. But I would need this to only start calculating for the current week and onwards.