Calculating Avg Unit Margin @ Consolidated Levels
Posted: Wed May 25, 2011 4:34 pm
Hello,
I've successfully established avg price and avg cost for a price and cost cube at the C level. However, stuck on how to calculate margin at the C level.
Not not sure if it helps but I've attached an image of the screen.
Below are my rules;
SKIPCHECK;
#Calculate Unit Sale Price for consolidated levels
['UnitPrice_hold']=N:['Unit Sale Price'];
['UnitPrice_count']=N: IF(['Unit Sale Price'] <> 0,1,0);
['Unit Sale Price']=C:['UnitPrice_hold'] \ ['UnitPrice_count'];
#Calculate Average Unit Cost for consolidated levels
['UnitCost_hold']=N:['Unit Cost'];
['UnitCost_count']=N: IF(['Unit Cost'] <> 0,1,0);
['Unit Cost']=C:['UnitCost_hold'] \ ['UnitCost_count'];
#Calculate Unit Margin and Unit Margin %
['Unit Margin']=N:['Unit Sale Price']-['Unit Cost'];
['Unit Margin %']=N:['Unit Margin']/['Unit Sale Price'];
#Calculate Average Unit Margin
['UnitMargin_hold']=N:['Unit Margin'];
['Unit Margin']=C:['Unit Sale Price']-['Unit Cost'];
Feeders;
['Unit Sale Price']=>['UnitPrice_hold'],['UnitPrice_count'];
['Unit Cost']=>['UnitCost_hold'],['UnitCost_count'];
['Unit Margin']=>['UnitMargin_hold'];
['Unit Sale Price']=>['Unit Margin'];
['Unit Cost']=>['Unit Margin'];
['Unit Margin']=>['Unit Margin %'];
Thanks
I've successfully established avg price and avg cost for a price and cost cube at the C level. However, stuck on how to calculate margin at the C level.
Not not sure if it helps but I've attached an image of the screen.
Below are my rules;
SKIPCHECK;
#Calculate Unit Sale Price for consolidated levels
['UnitPrice_hold']=N:['Unit Sale Price'];
['UnitPrice_count']=N: IF(['Unit Sale Price'] <> 0,1,0);
['Unit Sale Price']=C:['UnitPrice_hold'] \ ['UnitPrice_count'];
#Calculate Average Unit Cost for consolidated levels
['UnitCost_hold']=N:['Unit Cost'];
['UnitCost_count']=N: IF(['Unit Cost'] <> 0,1,0);
['Unit Cost']=C:['UnitCost_hold'] \ ['UnitCost_count'];
#Calculate Unit Margin and Unit Margin %
['Unit Margin']=N:['Unit Sale Price']-['Unit Cost'];
['Unit Margin %']=N:['Unit Margin']/['Unit Sale Price'];
#Calculate Average Unit Margin
['UnitMargin_hold']=N:['Unit Margin'];
['Unit Margin']=C:['Unit Sale Price']-['Unit Cost'];
Feeders;
['Unit Sale Price']=>['UnitPrice_hold'],['UnitPrice_count'];
['Unit Cost']=>['UnitCost_hold'],['UnitCost_count'];
['Unit Margin']=>['UnitMargin_hold'];
['Unit Sale Price']=>['Unit Margin'];
['Unit Cost']=>['Unit Margin'];
['Unit Margin']=>['Unit Margin %'];
Thanks