How to use the mdxpy.CalculatedMember function in mdxpy

To help you get started, we’ve selected a few mdxpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cubewise-code / tm1py / Tests / Cell.py View on Github external
def test_execute_mdx_csv_with_calculated_member(self):
        # MDX Query with calculated MEMBER
        mdx = MdxBuilder.from_cube(CUBE_NAME).with_member(CalculatedMember.lookup_attribute(
            DIMENSION_NAMES[1],
            DIMENSION_NAMES[1],
            "Calculated Member",
            DIMENSION_NAMES[0],
            "Attr3")) \
            .add_hierarchy_set_to_row_axis(MdxHierarchySet.all_members(DIMENSION_NAMES[0], DIMENSION_NAMES[0])) \
            .add_hierarchy_set_to_column_axis(
            MdxHierarchySet.member(Member.of(DIMENSION_NAMES[1], "Calculated Member"))) \
            .to_mdx()

        csv = self.tm1.cubes.cells.execute_mdx_csv(mdx)

        # check header
        header = csv.split('\r\n')[0]
        self.assertEqual(
            ",".join(DIMENSION_NAMES[0:2] + ["Value"]),