I am always getting a single value in MDX query using python. I am connecting to icCube which has xmla support.
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()
why does it always return a single value?
[[(Cell){
_CellOrdinal = "0"
Value = 0.0358054
FmtValue = "3.58%"
}]]
Are you sure the MDX query is expected to return more than one cell ?
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 " means the default member of [Client Country] so I believe this will return a single cell result. I would try the request in the icCube MDX editor.
Hope that helps.