I have several indicators which need to be "always up to date". I.e. when anything is changed I need to recalculate "dependent". I have several levels where each next level should be calculated only when previous level is calculated. Let me explain by this shining picture:
At some point Assume that Franc changed. Then we should:
Or, if Peso, Franc and Dinar are changed all at once then we should:
So whenever anything at the Level 0
is chagned we should recalculate all other levels. But
The most straightforward solution would be:
I guess that my problem is kind of well-known and probably you can suggest me general well-known solution. I don't want to reinvent the wheel :) Thanks!
To estimate the parameters, the Taylor series expansion of function Y is made in order to the parameters B and not to the vector X. ΔB(0) = vector (B - B(0)). Therefore: If ΔB(0) is "equal to zero" then the estimate of B is equal to B(0).
About parameter estimates (also called sample statistics) Parameters are descriptive measures of an entire population. However, their values are usually unknown because it is infeasible to measure an entire population. Because of this, you can take a random sample from the population to obtain parameter estimates.
You can add a parameter as an input to parameter from the create parameter dialog box. So the parameter 2 depends on parameter 1. You can make a parameter dependent by set from parameter option. 2 parameters can also be dependent when both are used in any field to perform any operations.
Under Parameters, right-click the parameter and select Show Parameter Control. From the Data pane, drag the calculated fields you created to the Columns and Rows shelves. From the Data pane, drag a measure to the view. In this example, Sales is placed on Label on the Marks card.
I think the level-based approach is decent, on the assumption that listeners are always on a lower level.
Have a 2D array containing your actual data, the first index is the level, the second is the position on the level. Let each element have a willBeRecalculated
flag.
Have a toBeRecalculated
list for each level (so an array of lists).
For each element, have a list of elements (the listeners) containing 2 integers - one for level and one for index.
For each element to be modified, add the element to toBeRecalculated
on the appropriate level and set willBeRecalculated
to true.
Then go through toBeRecalculated
from the first to the last level, recalculating each element, setting its willBeRecalculated
to false and, for each listener, looking up the applicable element, if willBeRecalculated
is true, do nothing, otherwise, set willBeRecalculated
to true and add it to toBeRecalculated
on its (the listener's) level.
This approach doesn't go through all the data to check what needs to be modified / has been modified, it only checks applicable elements, and there are no repeated calculations.
For this:
(For my abbreviations I simply took the first letter of each word. I'm using 0-indexed arrays)
Actual data:
[[E, U, P, F, D],
[E+U, F/D],
[E/E+D, F/D/P],
[P+E/E+U]
]
Listeners:
E:[(1,0), (2,0)] // E+U and E/E+U
U:[(1,0)] // E+U
P:[(2,1), (3,0)]
F:[(1,1)]
D:[(1,1)]
E+U:[(2,0)]
F/D:[(2,1)]
E/E+U:[(3,0)]
Modifying E
and U
:
Add E
and U
to toBeRecalculated[0]
and set willBeRecalculated
to true for both.
Go through toBeRecalculated[0]
.
When modifying E
, set willBeRecalculated
to false for it and set E+U
's willBeRecalculated
to true and add it to toBeRecalculated[1]
and set E/E+U
's willBeRecalculated
to true and add it to toBeRecalculated[2]
.
When modifying U
, set willBeRecalculated
to false for it and we check E+U
's willBeRecalculated
and see it's true so do nothing.
Then go through toBeRecalculated[1]
. When modifying E+U
, set willBeRecalculated
to false for it and check E/E+U
's willBeRecalculated
and see it's true so do nothing.
It might be better to have the listeners be pointers to the elements instead of a level and an index variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With