tm1py icon indicating copy to clipboard operation
tm1py copied to clipboard

Refactor `get_member_proprties` and add columns for weights

Open MariusWirtz opened this issue 2 years ago • 0 comments

Built with Power BI in mind as a data source the get_member_proprties function, is located in the PowerBiService and does not retrieve weights to parents.

However, the function can be useful in different contexts, beyond Power BI, so it should be implemented in the ElementService and only be referenced in the PowerBIService.

Also, it should offer to include an additional column for each parent (level000, level001, etc.) to retrieve the weight (level000 weight, level 001 weight, etc.)

from TM1py import TM1Service

if __name__ == "__main__":
    with TM1Service(address="", port=12354, ssl=True, user="admin", password="apple") as tm1:
        df = tm1.power_bi.get_member_properties(dimension_name="Airport", hierarchy_name="Airport")

    print(df.to_markdown())
Airport Type Hub City Country Description Test level002 level001 level000
0 ADL Numeric Asia Adelaide Australia ADL - Adelaide Airport Australia Asia ALL AIRPORT
1 AVV Numeric Asia Melbourne Australia AVV - Avalon Airport Australia Asia ALL AIRPORT

MariusWirtz avatar Oct 13 '22 11:10 MariusWirtz