Blin4ik
Blin4ik

Reputation: 3

MDX calculated measure by dimension value

I have to filter the measure value by a value in a the article group dimension.

Starting point:

Facts:

Dimensions:

We have 2 types of sale:

My MDX-Script calculates dynamically the daily stock over a month. The problem is that service-sales should not affects the inventory, so my script have to filter the measure value.

Such like:

CREATE MEMBER CURRENTCUBE.[Measures].[FilteredAmount]
AS (SELECT [Measures].[SalesAmount] FROM [Cube]
    WHERE [Article Group].[Service].&[0])
-- Service "0" = not service

CREATE MEMBER CURRENTCUBE.[Measures].[Amount]
AS [Measures].[OStockAmount] - [Measures].[FilteredAmount]  

I don't know how to filter the value

Upvotes: 0

Views: 1463

Answers (1)

GregGalloway
GregGalloway

Reputation: 11625

Try this:

CREATE MEMBER CURRENTCUBE.[Measures].[FilteredAmount]
AS ([Measures].[SalesAmount], [Article Group].[Service].&[0]);
-- Service "0" = not service

That creates a tuple that just retrieves a section of the cube... Measure SalesAmount and Service=0

Upvotes: 1

Related Questions