【问题标题】:Sales cost this month and month before本月和前一个月的销售成本
【发布时间】:2012-08-01 06:55:52
【问题描述】:

您必须计算产品在一个月内的销售成本值。每月的费用可能会有所不同,因此我必须计算给定月份的平均费用。

我有一个产品的每次销售的列以及该产品的最后成本

度量“最后价格成本”计算为该列的“儿童平均数”

测量似乎是正确的

现在我需要计算上个月相同的平均成本。

我的计算量度如下:

会员 SalesCostMonthBefore AS (parallelPeriod([Dim Time].[Year - Month - Date].[Month],1 ), [措施].[SalesLastPriceCostUnitary])

但这并没有得到正确的结果...(试用了始终具有相同成本的产品,本月的价格为 4.72 欧元(正确),但上个月的价格为 5.66 欧元(不正确)

【问题讨论】:

    标签: mdx


    【解决方案1】:

    您是否指定了当前成员的时间?

    函数 ParallelPeriod 与 [Dim Time] CurrentMember 参数一起使用。

    在下一个查询示例中,时间 CurrentMember 为 [Dim Time].[Year - Month - Date].&[2012].&[02]:

    WITH
    MEMBER SalesCostMonthBefore AS (parallelPeriod([Dim Time].[Year - Month - Date].[Month],1 ), [Measures].[SalesLastPriceCostUnitary])
    Select
    {SalesCostMonthBefore} On 0, 
    {Products.Category.Members} ON 1
    From CUbeName
    WHERE  ([Dim Time].[Year - Month - Date].&[2012].&[02])
    

    【讨论】:

      猜你喜欢
      • 2021-03-08
      • 1970-01-01
      • 1970-01-01
      • 2021-03-14
      • 2015-02-20
      • 2022-11-10
      • 1970-01-01
      • 2021-10-12
      • 1970-01-01
      相关资源
      最近更新 更多