Skip to content

Conversation

@MariusWirtz
Copy link
Collaborator

The new change allows this:

from TM1py import TM1Service

with TM1Service(base_url="https://localhost:12354", user="admin", password="apple") as tm1:
    mdx = """
    SELECT
    NON EMPTY Tm1FilterByLevel({TM1SubsetAll([d1])},0) on 0,
    NON EMPTY Tm1FilterByLevel({TM1SubsetAll([d2])},0) on 1,
    NON EMPTY Tm1FilterByLevel({TM1SubsetAll([d3])},0) on 2,
    NON EMPTY Tm1FilterByLevel({TM1SubsetAll([d4])},0) on 3,
    NON EMPTY Tm1FilterByLevel({TM1SubsetAll([d5])},0) on 4
    FROM [c5]
    """

    cells = tm1.cells.execute_mdx(mdx, element_unique_names=False, skip_cell_properties=True)
    for elements, value in cells.items():
        print(elements, value)
('e1', 'e1', 'e01', 'e01', 'e01') 4
('e1', 'e1', 'e01', 'e02', 'e01') 1
('e1', 'e1', 'e01', 'e01', 'e02') 2
('e1', 'e1', 'e01', 'e02', 'e02') 3

@wimgielis
Copy link
Contributor

wimgielis commented Aug 8, 2022 via email

@rclapp
Copy link
Collaborator

rclapp commented Aug 9, 2022 via email

@MariusWirtz
Copy link
Collaborator Author

@wimgielis I don't know what PAW does in detail, but the API responses are consistent with the MDX queries.

We noticed that when using asymmetric tuples in the selections, multi-axes queries perform much better than queries with stacked selections on 0 or 1.

@rclapp
Copy link
Collaborator

rclapp commented Aug 9, 2022

@MariusWirtz do you have an example query that you can share?

@MariusWirtz
Copy link
Collaborator Author

@rclapp here is a sample:

SELECT
NON EMPTY {
([Cost Center].[10], [Company].[22]),
([Cost Center].[29], [Company].[62]),
([Cost Center].[15], [Company].[23])
} ON 0,
NON EMPTY {
([Year].[2022], [Month].[1]),
([Year].[2021], [Month].[2]),
([Year].[2020], [Month].[3])
} ON 1,
NON EMPTY {
([State].[CA], [Version].[Actual]),
([State].[OK], [Version].[Budget]),
([State].[FL], [Version].[Forecast]),
} ON 2,
NON EMPTY {
([PC].[110], [LOB].[55]),
([PC].[210], [LOB].[33]),
([PC].[92], [LOB].[12]),
} ON 3
FROM [GL]

The above executes faster than the below in my tests.

SELECT
NON EMPTY {
([Cost Center].[10], [Company].[22]),
([Cost Center].[29], [Company].[62]),
([Cost Center].[15], [Company].[23])
} ON 0,
NON EMPTY {
([Year].[2022], [Month].[1]),
([Year].[2021], [Month].[2]),
([Year].[2020], [Month].[3])
} * {
([State].[CA], [Version].[Actual]),
([State].[OK], [Version].[Budget]),
([State].[FL], [Version].[Forecast]),
} * {
([PC].[110], [LOB].[55]),
([PC].[210], [LOB].[33]),
([PC].[92], [LOB].[12]),
} ON 1
FROM [GL]

@MariusWirtz MariusWirtz merged commit 941d655 into master Aug 12, 2022
@MariusWirtz MariusWirtz deleted the feature/execute-mdx-multi-axes branch April 9, 2023 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants