Forum Discussion

GoingIncognito's avatar
GoingIncognito
Icon for Advocate III rankAdvocate III
6 years ago
Solved

Trouble implementing treatas()

My problem is that I've different tables for a portfolio and a benchmark it is being compared to. These tables are not connected, so I assume I can solve my problem using TREATAS().   I've a measur...
  • v-gizhi-msft's avatar
    6 years ago

    Hi,

     

    According to your description, i think you have at least three tables and the problem you have due to no relationship berween another two tables.

    So i create three tables to test:

    And for your second measure, i make some changes to it:

    measure 2 =
    CALCULATE (
        DIVIDE (
            SUM ( Position[MARKET_TOTAL_IN_EUR] ),
            CALCULATE (
                SUM ( Position[MARKET_TOTAL_IN_EUR] ),
                ALLSELECTED ( Security[CLASS2] ),
                ALLSELECTED ( Security[NAME1] ),
                TREATAS ( VALUES ( Index[CLASS2] ), Security[CLASS2] ),
                TREATAS ( VALUES ( Security[NAME1] ), Position[name1] )
            )
        )
    )

    The result shows:

    Here is my test pbix file:

    pbix 

     

    Best Regards,

    Giotto Zhi