tm1py
tm1py copied to clipboard
`execute_mdx_dataframe` to support multi axes MDX queries
The execute_mdx_dataframe
function doesn't work with multi-axes MDX queries.
Only the first two axes are considered in the resulting data frame. See below. This needs to be addressed.
from TM1py import TM1Service
with TM1Service(base_url="https://localhost:12354", user="admin", password="apple") as tm1:
mdx = """
SELECT
Tm1FilterByLevel({TM1SubsetAll([d3])},0) on 0,
Tm1FilterByLevel({TM1SubsetAll([d4])},0) on 1,
Tm1FilterByLevel({TM1SubsetAll([d5])},0) on 2
FROM [c4]
"""
df = tm1.cells.execute_mdx_dataframe(mdx)
print(df.head().to_markdown())
d4 | d3 | Value | |
---|---|---|---|
0 | e01 | e01 | 8 |
1 | e01 | e02 | 8 |
2 | e01 | e03 | 8 |
3 | e01 | e04 | 8 |
4 | e01 | e05 | 8 |
Why not just stack selections on axis 1 or 0 ? When using tuples in the selections, multi-axes selections perform better than stacked selections