Get a % based on different field values
Hi all,
This one has me pulling out what is left of my hair.
I have a dimension called 'Revenue' that consists of 3 members.
'Full Price', 'Orig Price', and 'Sale Discount'
I want to work out the Planned Gross Margin %. In code speak it looks like this:
SELECT CASE RevenueMember
CASE 'Full Price' Then 'Planned Gross Margin %' = Planned Gross Profit / Planned Revenue Net VAT
CASE ''Sale Discount' Then 'Planned Gross Margin %' =
Planned Gross Profit /
(Orig Price, Planned Revenue Net VAT) + (Sale Discount, Planned Revenue Net VAT)
CASE 'Original Price' Then 'Planned Gross Margin %' is nothing
I have it working in a MDX query but for the life of me cannot see how to get it into a report.
In case anyone can be bothered here is the MDX query that returns what I want.
WITH MEMBER [priv_Revenue Group].[Revenue Group].[Total] AS
([priv_Revenue Group].[Revenue Group].&[Sale - Discount],[Measures].[Planned Revenue Net Vat])
+
([priv_Revenue Group].[Revenue Group].&[Sale - Orig. Price],[Measures].[Planned Revenue Net Vat])
,SOLVE_ORDER =1
MEMBER [priv_Revenue Group].[Revenue Group].[DiscountPGMPer] AS
(
[priv_Revenue Group].[Revenue Group].&[Sale - Discount]
,[Measures].[Planned Gross Profit]
)/
[priv_Revenue Group].[Revenue Group].[Total]
,SOLVE_ORDER =2,FORMAT_STRING = "Percent"
MEMBER [priv_Revenue Group].[Revenue Group].[FPPGMPPerc] AS
(
[priv_Revenue Group].[Revenue Group].&[Full Price],
[Measures].[Planned Gross Profit]
)
/
(
[priv_Revenue Group].[Revenue Group].&[Full Price]
,[Measures].[Planned Revenue Net Vat]
)
,SOLVE_ORDER =3,FORMAT_STRING = "Percent"
SELECT
[Measures].[Planned Revenue Net Vat] ON 0,
[priv_Revenue Group].[Revenue Group].ALLMEMBERS ON 1
FROM [cube_SalesAndDiscount_Review_Weekly]
WHERE
([dim_Warehouse].[Warehouse Name].[301: 77 Fulham Road]
,[dim_CFO_Calendar].[Calendar - CFO].[Week Commencing].&[2.011E3]&[1.2E1]&[1.]
,[dim_Item].[Item Procurement Group].&[94]
,[dim_Item].[Item Season].[W0: HIVER/WINTER 2010])
Which returns:
Planned Revenue Net Vat
All 45,478
Full Price 23,217
Sale - Discount (2,474)
Sale - Orig. Price 24,735
Total 22,262
DiscountPGMPer 51.65%
FPPGMPPerc 56.48%
Thanks in advance anyone.
April 14th, 2011 9:20am
I created a calculated member that done the Summing up and then plugged that into the main calculation.
Worked a treat.
Free Windows Admin Tool Kit Click here and download it now
April 14th, 2011 10:38am