olivierhbh
Board Regular
- Joined
- Jun 22, 2015
- Messages
- 136
Hello all,
I need to calculate stocks, here is a simplified set of data:
[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH]id[/TH]
[TH]year[/TH]
[TH]month[/TH]
[TH]prod[/TH]
[TH]start[/TH]
[TH]start_calculated[/TH]
[TH]end[/TH]
[/TR]
[TR]
[TD]1[/TD]
[TD]2001[/TD]
[TD]11[/TD]
[TD]13[/TD]
[TD]45[/TD]
[TD]45[/TD]
[TD]58[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2001[/TD]
[TD]12[/TD]
[TD]74[/TD]
[TD] [/TD]
[TD]58[/TD]
[TD]132[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2002[/TD]
[TD]1[/TD]
[TD]86[/TD]
[TD] [/TD]
[TD]132[/TD]
[TD]218[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2002[/TD]
[TD]2[/TD]
[TD]56[/TD]
[TD] [/TD]
[TD]218[/TD]
[TD]274[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2002[/TD]
[TD]3[/TD]
[TD]91[/TD]
[TD] [/TD]
[TD]274[/TD]
[TD]365[/TD]
[/TR]
</tbody>[/TABLE]
I want to calculate the initial stock and the final stock of each month, the initial stock is the final stock of the previous month and the final stock equals initial stock + production.
The column id to the column start represent the database. There is one row per month.
I need to calculate the start_calculated and end data.
start_calculated should be equal to start if there is something, else to the value in the field end of the previous month.
end should sum start_calculated and prod.
The circular dependency is obvious, I use start_calculated to calculate end and end to calculate start_calculated.
Could you help me find a workaround to achieve this result without using Power Query or editing the initial database?
Many thanks in advance for your help.
Olivier.
I need to calculate stocks, here is a simplified set of data:
[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH]id[/TH]
[TH]year[/TH]
[TH]month[/TH]
[TH]prod[/TH]
[TH]start[/TH]
[TH]start_calculated[/TH]
[TH]end[/TH]
[/TR]
[TR]
[TD]1[/TD]
[TD]2001[/TD]
[TD]11[/TD]
[TD]13[/TD]
[TD]45[/TD]
[TD]45[/TD]
[TD]58[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2001[/TD]
[TD]12[/TD]
[TD]74[/TD]
[TD] [/TD]
[TD]58[/TD]
[TD]132[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2002[/TD]
[TD]1[/TD]
[TD]86[/TD]
[TD] [/TD]
[TD]132[/TD]
[TD]218[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2002[/TD]
[TD]2[/TD]
[TD]56[/TD]
[TD] [/TD]
[TD]218[/TD]
[TD]274[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2002[/TD]
[TD]3[/TD]
[TD]91[/TD]
[TD] [/TD]
[TD]274[/TD]
[TD]365[/TD]
[/TR]
</tbody>[/TABLE]
I want to calculate the initial stock and the final stock of each month, the initial stock is the final stock of the previous month and the final stock equals initial stock + production.
The column id to the column start represent the database. There is one row per month.
I need to calculate the start_calculated and end data.
start_calculated should be equal to start if there is something, else to the value in the field end of the previous month.
end should sum start_calculated and prod.
The circular dependency is obvious, I use start_calculated to calculate end and end to calculate start_calculated.
Could you help me find a workaround to achieve this result without using Power Query or editing the initial database?
Many thanks in advance for your help.
Olivier.