我总是在使用 python 的 MDX 查询中获取单个值。我正在连接到支持 xmla 的 icCube。
provider = xmla.XMLAProvider()
con = provider.connect(location='conn_str',username='q1',password='q2')
cmd="""WITH MEMBER Measures.[Avg Profit Margin] AS Sum(SOMETHING, Measures.[Profit Margin]) select NON EMPTY {[Measures].[Profit Margin]} ON columns, {[Client Country]} ON rows FROM [XYZ]"""
res=con.Execute(cmd,Catalog="cube_closed_contracts")
print res.getSlice()
为什么总是返回一个值?
[[(Cell){
_CellOrdinal = "0"
Value = 0.0358054
FmtValue = "3.58%"
}]]
最佳答案
您确定 MDX 查询会返回多个单元格吗?
WITH MEMBER Measures.[Avg Profit Margin] AS ...
select
NON EMPTY {[Measures].[Profit Margin]} ON columns,
{[Client Country]} ON rows
FROM [XYZ]
“[Client Country] on rows”表示 [Client Country] 的默认成员,因此我相信这将返回单个单元格结果。我会在 icCube MDX 编辑器中尝试请求。
希望对您有所帮助。
关于python olap.xmla mdx 查询返回单个值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29427296/