Skip to content

PowerBiService

PowerBiService(tm1_rest)

Parameters:

Name Type Description Default
tm1_rest

instance of RestService

required
Source code in TM1py/Services/PowerBiService.py
def __init__(self, tm1_rest):
    """

    :param tm1_rest: instance of RestService
    """
    self._tm1_rest = tm1_rest
    self.cells = CellService(tm1_rest)
    self.elements = ElementService(tm1_rest)

cells = CellService(tm1_rest) instance-attribute

elements = ElementService(tm1_rest) instance-attribute

execute_mdx(mdx, **kwargs)

Source code in TM1py/Services/PowerBiService.py
@require_pandas
def execute_mdx(self, mdx, **kwargs) -> "pd.DataFrame":
    return self.cells.execute_mdx_dataframe_shaped(mdx, **kwargs)

execute_view(cube_name, view_name, private, use_iterative_json=False, use_blob=False, **kwargs)

Source code in TM1py/Services/PowerBiService.py
@require_pandas
def execute_view(
    self, cube_name: str, view_name: str, private: bool, use_iterative_json=False, use_blob=False, **kwargs
) -> "pd.DataFrame":
    return self.cells.execute_view_dataframe_shaped(
        cube_name, view_name, private, use_iterative_json=use_iterative_json, use_blob=use_blob, **kwargs
    )

get_member_properties(dimension_name=None, hierarchy_name=None, member_selection=None, skip_consolidations=True, attributes=None, skip_parents=False, level_names=None, parent_attribute=None, skip_weights=True, use_blob=False, **kwargs)

Parameters:

Name Type Description Default
dimension_name str

Name of the dimension

None
hierarchy_name str

Name of the hierarchy in the dimension

None
member_selection Iterable

Selection of members. Iterable or valid MDX string

None
skip_consolidations bool

Boolean flag to skip consolidations

True
attributes Iterable

Selection of attributes. Iterable. If None retrieve all.

None
level_names

List of labels for parent columns. If None use level names from TM1.

None
skip_parents bool

Boolean Flag to skip parent columns.

False
parent_attribute str

Attribute to be displayed in parent columns. If None, parent name is used.

None
skip_weights

include weight columns

True
use_blob

Better performance on large sets and lower memory footprint in any case. Requires admin permissions

False

Returns:

Type Description
DataFrame

pandas DataFrame

Source code in TM1py/Services/PowerBiService.py
@require_pandas
def get_member_properties(
    self,
    dimension_name: str = None,
    hierarchy_name: str = None,
    member_selection: Iterable = None,
    skip_consolidations: bool = True,
    attributes: Iterable = None,
    skip_parents: bool = False,
    level_names=None,
    parent_attribute: str = None,
    skip_weights=True,
    use_blob=False,
    **kwargs,
) -> "pd.DataFrame":
    """

    :param dimension_name: Name of the dimension
    :param hierarchy_name: Name of the hierarchy in the dimension
    :param member_selection: Selection of members. Iterable or valid MDX string
    :param skip_consolidations: Boolean flag to skip consolidations
    :param attributes: Selection of attributes. Iterable. If None retrieve all.
    :param level_names: List of labels for parent columns. If None use level names from TM1.
    :param skip_parents: Boolean Flag to skip parent columns.
    :param parent_attribute: Attribute to be displayed in parent columns. If None, parent name is used.
    :param skip_weights: include weight columns
    :param use_blob: Better performance on large sets and lower memory footprint in any case. Requires admin permissions

    :return: pandas DataFrame
    """
    if not skip_weights and skip_parents:
        raise ValueError("skip_weights must not be False if skip_parents is True")

    return self.elements.get_elements_dataframe(
        dimension_name=dimension_name,
        hierarchy_name=hierarchy_name,
        elements=member_selection,
        skip_consolidations=skip_consolidations,
        attributes=attributes,
        skip_parents=skip_parents,
        level_names=level_names,
        parent_attribute=parent_attribute,
        skip_weights=skip_weights,
        use_blob=use_blob,
        **kwargs,
    )