data from a Cube or Report
from mstrio.project_objects import OlapCube, Report
from mstrio.connection import get_connection
PROJECT_NAME = '<Project_name>'
CUBE_ID = "<Cube_ID>"
REPORT_ID = "<Report_ID>"
ATTRIBUTES_LIST = [
"<Attribute_ID>", "<Attribute_ID>"
]
METRICS_LIST = ["<Metric_ID>"]
ATTRIBUTES_ELEMENTS_LIST = ["<Attribute_ID:Element_Name>", "<Attribute_ID:Element_Name>"]
conn = get_connection(workstationData, project_name=PROJECT_NAME)
my_cube = OlapCube(connection=conn, id=CUBE_ID)
my_cube_df = my_cube.to_dataframe()
my_report = Report(connection=conn, id=REPORT_ID, parallel=False)
my_report_df = my_report.to_dataframe()
my_cube.metrics
my_cube.attributes
my_cube.attr_elements
my_cube.apply_filters(
attributes=ATTRIBUTES_LIST,
metrics=METRICS_LIST,
attr_elements=ATTRIBUTES_ELEMENTS_LIST,
)
my_cube.selected_attributes
my_cube.selected_metrics
my_cube.selected_attr_elements
my_cube_applied_filters_df = my_cube.to_dataframe()
my_cube.apply_filters(
attributes=ATTRIBUTES_LIST,
metrics=METRICS_LIST,
attr_elements=ATTRIBUTES_ELEMENTS_LIST,
operator="NotIn",
)
my_cube_excluded_elements_df = my_cube.to_dataframe()