2014-06-19 115 views
0

我不知道MDX的ABCD。我的這個查詢是由我的前任交給我的,而且一年只需要一次!一年中的這個時間恰好是現在!查詢運行並返回結果。但是,我無法將結果與SSAS結果窗口中的行和列名稱一起復制。MDX結果Excel到Power Pivot

谷歌搜索我發現鏈接服務器的選項,使用SSIS包和PowerPivot設置查詢選項以將結果保存爲csv等。

由於數據庫的限制,前兩種是不可能的。我需要通過一些企業障礙來獲得必要的權限。

SSIS包和Power Pivot - 具有相同的問題。 'BUD'是一個命名集合,它在select語句中的下面的過濾器中被引用。兩個SSIS(當在OLEDB源文件中輸入時)都會報錯 - 未找到維度[BUD]。

使用PowerPivot,我分別執行set create create語句,然後在'WITH'後僅粘貼代碼。錯誤是 - 未找到維度[BUD]。

如何在Power Pivot或SSIS的select語句中引用BUD的任何幫助?我正在使用sqlsever2008r2。

程序 -

create set [DB1].BUD AS 
nonemptycrossjoin(

    {[Market].[Markets].&[Europe].children,[Market].[Markets].[Part of World].&[Africa].children}, 
    [Product].[PL].&[CD] : [Product].[PL].&[KZ], 
    [Plant].[Plant].children 
) go 


with 

member measures.callsCY1 as 
/* Lot of measure calutaions here */ 

select 
non empty 
{ 
[Measures].[Qty Sold], 
callsCY1,costCY1,MTRLcostCY1,LabourCostCY1, 
SCR_C,callsRY1,costRY1,MTRLcostRY1,LabourCostRY1, 
callsCY2,costCY2,MTRLcostCY2,LabourCostCY2, 
callsRY2,costRY2,MTRLcostRY2,LabourCostRY2, 
callsCY3,costCY3,MTRLcostCY3,LabourCostCY3, 
callsRY3,costRY3,MTRLcostRY3,LabourCostRY3 
} 
* 
{[Report Period].[Report Periods].[Quarter].&[2013-01-01T00:00:00] : [Report Period].[Report Periods].[Quarter].&[2014-06-01T00:00:00]} 
on 0, 
non empty 
filter(
bud, [Measures].[Qty Sold] <> 0 OR [Measures].[QTY Service Calls] <> 0) 
on 1 
from [db1] 

回答

1

芽是否需要被單獨?你不能用這個嗎?

with 
set [BUD] AS 
nonemptycrossjoin(

    {[Market].[Markets].&[Europe].children,[Market].[Markets].[Part of World].&[Africa].children}, 
    [Product].[PL].&[CD] : [Product].[PL].&[KZ], 
    [Plant].[Plant].children 
) 
member measures.callsCY1 as 
/* Lot of measure calutaions here */ 

select 
non empty 
{ 
[Measures].[Qty Sold], 
callsCY1,costCY1,MTRLcostCY1,LabourCostCY1, 
SCR_C,callsRY1,costRY1,MTRLcostRY1,LabourCostRY1, 
callsCY2,costCY2,MTRLcostCY2,LabourCostCY2, 
callsRY2,costRY2,MTRLcostRY2,LabourCostRY2, 
callsCY3,costCY3,MTRLcostCY3,LabourCostCY3, 
callsRY3,costRY3,MTRLcostRY3,LabourCostRY3 
} 
* 
{[Report Period].[Report Periods].[Quarter].&[2013-01-01T00:00:00] : [Report Period].[Report Periods].[Quarter].&[2014-06-01T00:00:00]} 
on 0, 
non empty 
filter(
bud, [Measures].[Qty Sold] <> 0 OR [Measures].[QTY Service Calls] <> 0) 
on 1 
from [db1] 
+0

感謝您的回覆。該聲明在SSMS上完美執行。在PowerPivot中運行查詢時,出現此錯誤 - 將數據溢出轉換爲表'Query'列'MeasuresSCR_CReport PeriodReport PeriodsQuarter2014-04-01T000000'的數據類型。 當前操作被取消,因爲事務中的另一個操作失敗。這是什麼意思?我應該更改Excel中的任何默認設置嗎? – SKa

+0

@SKa道歉,但我對PowerPivot的知識目前不存在。這傢伙克里斯韋伯是這個領域的領導者,也許他的博客中有一個答案:https://cwebbbi.wordpress.com/category/powerpivot/。如果查詢在SSMS內執行,但是PP方面出現錯誤,那麼我認爲你對Excel問題的假設可能是正確的。 – whytheq

+0

不過謝謝@whytheq – SKa