2014-06-19 80 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