Skip to content

Generated MDX is incorrect with multiple dimensions on row or column Axis. #55

@swaterbury-CW

Description

@swaterbury-CW

When using:

  for dim in dims:
        elements_dict = tm1.elements.get_leaf_elements(dimension_name=dim, hierarchy_name=dim)
        print(dim)
        element_sample = elements_dict
        if elements_dict.__len__() > 10:
            k = int(round(len(elements_dict) * percent, 0))
            element_sample = random.sample(elements_dict, k=1)

        if dim == dims[0]:
            for el in element_sample:
                mdx = mdx.add_member_tuple_to_columns(el.unique_name)
        else:
            for el in element_sample:
                mdx = mdx.add_member_tuple_to_rows(el.unique_name)

MDX generated follows the format on row Axis of

{([Dim1].[Dim1].[Dim1Element]),([Dim2].[Dim2].[Dim2Element])}

This is an incorrect MDX string for multiple stacked dimensions and it fails to render. When manually modified to:

{[Dim1].[Dim1].[Dim1Element]}*{[Dim2].[Dim2].[Dim2Element]}

MDX Returns successfully and without error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions