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.