如何在MDX中获得最后的销售价格

时间:2016-01-18 03:56:44

标签: sql ssas mdx

MDX可以按照以下代码返回预期结果吗? 拥有如下数据:

DATA:       
ItemID  DateKey Price
A   20151230    4.85
A   20150520    5.5
A   20150325    4.65
B   20140130    3
B   20141130    5
B   20150630    4.5

Wrong Result:
ItemID  DateKey Price
A   20151230    4.65
B   20150630    3

Expected Result:
ItemID  DateKey Price
A   20151230    4.85
B   20150630    4.5

WITH MEMBER [LastDate] AS tail (Filter([BI Dim Date].[Date Key].[Date Key],[Measures].[PRICE])).Item(0).name
MEMBER [LastDateWithSales] AS Filter([MyTest].[PRICE].[PRICE],[Measures].[LastDate]).Item(0).name

SELECT { [LastDate], [LastDateWithSales]} ON columns,
[MyTest].[ITEMID].[ITEMID] on rows
FROM [MyCube]

执行上面的MDX但得到错误的结果。请指教。

1 个答案:

答案 0 :(得分:0)

 $scope['object1'] = {};
    $scope['object1']['val'] = {};
    $scope['object2'] = {};
    $timeout(() => {
      this.$scope['object2']['val'] = this.$scope['object1']['val'];
      $timeout(() => {
       this.$scope['object2']['val'] = null;
          console.log(this.$scope['object1']['val']); // null
        })
    });