I'm having trouble with a rule that calculates Gross Margin % and Average Selling Price for Budget data at consolidated levels incorrectly (i.e. aggregating instead of overriding). I have no skipcheck in the rule for now. Budget data comes from the Sales Assumptions and Product Assumptions cubes, and Actual data resides in the Sales cube (where the rule resides). Is this something to do with the order I have my rules in my rule file?
Code: Select all
['Budget', 'Volume'] = N:
DB('Sales Assumptions', 'Budget', !Year, !Customer, !Product, 'New Full Year') \
DB('Sales','Actual', ATTRS('Year', !Year, 'Prev'), 'TOTAL YEAR', !Customer, !Product, 'Volume') *
DB('Sales','Actual', ATTRS('Year', !Year, 'Prev'), !Week, !Customer, !Product, 'Volume');
['Revenue'] = N: ['Volume'] * ['Average Selling Price'] ;
['Budget',{'Average Selling Price', 'Gross Margin %'}] = N: DB('Product Assumptions',!Product, !Revenue_Measures);
['Gross Margin'] = N: ['Revenue'] * ['Gross Margin %'] ;
['Average Selling Price'] = C: ['Revenue'] \ ['Volume'] ;
['Gross Margin %'] = C: ['Gross Margin'] \ ['Revenue'] ;
['Cumulative Margin'] =
DB('Sales', !Scenario, !Year, !Week | ' YTD', !Customer, !Product, 'Gross Margin') ;
Thanks in advance,
Dan