简体   繁体   English

MDX按尺寸值计算的度量

[英]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: 事实:

  • Inventory (only opening stock of a month) 库存(仅一个月的期初库存)
  • Sales 营业额

Dimensions: 尺寸图

  • Articlegroup (content: articlegroup types: Service or not) 文章组(内容:文章组类型:是否提供服务)
  • Article 文章
  • Time 时间

We have 2 types of sale: 我们有2种销售类型:

  • Standard sale (affects invetory) 标准销售(影响活动)
  • Service (doesn't affects inventory) 服务(不影响库存)

My MDX-Script calculates dynamically the daily stock over a month. 我的MDX脚本动态计算一个月内的每日库存。 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 我不知道如何过滤值

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 这将创建一个元组,而该元组仅检索多维数据集的一部分...测量SalesAmount和Service = 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM