Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
NG24
New Member

How to show different percentage returns in Matrix

Hi, I am having a hard time trying to show program (Hierarchy 1) returns that are not a sum of the portfolio (Hierarchy 2) returns.

I have 2 raw data tables and one is for the program and portfolio returns and the other is for sorting the portfolios into the correct order.

PortfolioPortfolio Returns
Asia5%
Asian Equities2%
Asian Credit3%
Asian Derivatives4%

 

ProgramPortfolioPortfolio Sort ID
AsiaAsian Equities1
AsiaAsian Credit2
AsiaAsian Derivatives3

 

I would like my matrix to show this (Asia shows its own returns):

MatrixPortfolio Returns
Asia5%
    Asian Equities2%
    Asian Credit3%
    Asian Derivatives4%

 

However, it is currently showing this (Asia is summing up the individual portfolio returns)

MatrixPortfolio Returns
Asia9%
    Asian Equities2%
    Asian Credit3%
    Asian Derivatives4%

 

Is there a way to show my program (Asia) return in a matrix table that doesn't sum up the individual portfolios?

 

Thanks

1 ACCEPTED SOLUTION

Hi @NG24 ,

 

Please try:

Measure = 
VAR _a =
    CALCULATE (
        SUM ( 'Table 1'[Portfolio Returns] ),
        FILTER ( 'Table 1', 'Table 1'[Portfolio] = MAX ( 'Table 2'[Portfolio] ) )
    )
VAR _b =
    CALCULATE (
        SUM ( 'Table 1'[Portfolio Returns] ),
        FILTER ( 'Table 1', 'Table 1'[Portfolio] = MAX ( 'Table 2'[Program] ) )
    )
RETURN
    IF (
        HASONEVALUE ( 'Table 2'[Program] ),
        IF ( ISINSCOPE ( 'Table 2'[Portfolio] ), _a, _b ),
        BLANK ()
    )

Final output:

vjianbolimsft_0-1668065735649.png

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @NG24 ,

 

Please try:

Measure = 
IF (
    ISINSCOPE ( 'Table (2)'[Portfolio] ),
    CALCULATE (
        MAX ( 'Table'[Portfolio Returns] ),
        FILTER ( 'Table', [Portfolio] = MAX ( 'Table (2)'[Portfolio] ) )
    ),
    CALCULATE (
        MAX ( 'Table'[Portfolio Returns] ),
        FILTER ( 'Table', [Portfolio] = MAX ( 'Table (2)'[Program] ) )
    )
)

Final output:

vjianbolimsft_0-1667804469417.png

Note: There do not have any relationship between the two tables.

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the measure! Your screenshot is what i'm trying to achieve without the total row.

A few followup questions:

Can this measure work if the parent does not have the highest % return in the hierarchy?

I tried testing out the measure with another hierarchies and this is what i'm seeing:

 

NG24_1-1667827016415.png

Asia has a return of 5% and Weather has a return of 0.05%

Is there a way to show the returns for Asia and Weather and remove the Total Return row?

The below are my tables with no relationships between them.

Table 1

PortfolioPortfolio Returns
Asia5.00%
Asian Equities2.00%
Asian Credit3.00%
Asian Derivatives4.00%
Weather0.05%
Snow1.00%
Rain2.00%
Ice3.00%

 

Table 2

ProgramPortfolio
AsiaAsian Equities
AsiaAsian Credit
AsiaAsian Derivatives
WeatherSnow
WeatherRain
WeatherIce

Hi @NG24 ,

 

Please try:

Measure = 
VAR _a =
    CALCULATE (
        SUM ( 'Table 1'[Portfolio Returns] ),
        FILTER ( 'Table 1', 'Table 1'[Portfolio] = MAX ( 'Table 2'[Portfolio] ) )
    )
VAR _b =
    CALCULATE (
        SUM ( 'Table 1'[Portfolio Returns] ),
        FILTER ( 'Table 1', 'Table 1'[Portfolio] = MAX ( 'Table 2'[Program] ) )
    )
RETURN
    IF (
        HASONEVALUE ( 'Table 2'[Program] ),
        IF ( ISINSCOPE ( 'Table 2'[Portfolio] ), _a, _b ),
        BLANK ()
    )

Final output:

vjianbolimsft_0-1668065735649.png

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.