najczuk wrote:Ok, but how to write a rule that will apply ATTRS function on every date/team leaf element.
Use the N: qualifier in the rule - this is one of the reasons I asked if the time dimensions were the same or different. Using N: will make the rule act only at the leaf level of the cube. So, you write the rule like this:
Code: Select all
['Margin']= N: DB('Margin_Cube', !Team_Dim,Attrs('Date_Dim',!Date_Dim,'Month'), 'Margin');
This means the Month attribute should be populated against the dd/mm/yyyy elements in Date_Dim. In Team_Dim you need to create a Project attribute and populate the relevant project for the team - same concept as dates and months.
Regarding this:
Code: Select all
['Margin']=DB('Margin_Cube', !Team_Dim,ELPAR('Date_Dim',!Date_Dim,2), 'Margin');
You should avoid using ELPAR in rules as the index may change over time as new hierarchies are built, old ones removed etc. What is the 2nd parent today may not be the same one tomorrow. It's a common re-factoring strategy to replace all use of ELPAR with attribute look-ups. ELPAR is still useful for reports and so forth, but not in the back-end logic.