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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
SandroRiz
Helper I
Helper I

Percentage of total in a matrix grid for second dimension

I have a matrix grid with the Sales by Country and foreach Country the sales by product category

 

I want the % of total by Country and that's easy, but obviously when I expand a country the number has no sense...

In the example, I would like to see Seafood is 12,48% of the 26k of Italy

 

Is such a thing possible?

Thanks

 

1.jpg2.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I see, you can test what dimensions are in scope and remove the concext acordingly.

 

Try this

 

Measure = 
IF(AND(ISINSCOPE('Country'[CountryName]),ISINSCOPE(Products[Category])),
DIVIDE(
    [TotalSales],
    CALCULATE(
        TotalSales,
        ALL(Products[Category])

)
),
DIVIDE(
    TotalSales,
    CALCULATE(
        TotalSales,
        ALL('Country'[CountryName])

)
)
    )

 

Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

View solution in original post

8 REPLIES 8
SandroRiz
Helper I
Helper I

BTW, do you perhaps know why in a new file I have the PLUS sign near every ROW, while in an old pbix (but same, last, version of client) I have the old arrows to expan/collapse all the rows ?

 

2022-10-17_184541.jpg

Anonymous
Not applicable

EDIT:

 

Hi

 

You are removing the filter context only from the product table. You need to do that for your sales table:

 

 

    DIVIDE(
        [TotalSales],
        CALCULATE(
            [TotalSales],
            ALL(Sales)
         )
    ) 

 

 

Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

That's better (number now make sense and are related to the gran total), but what I want to achieve is the % respect the parent total...

 

2022-10-17_115246.jpg

Anonymous
Not applicable

I see, you can test what dimensions are in scope and remove the concext acordingly.

 

Try this

 

Measure = 
IF(AND(ISINSCOPE('Country'[CountryName]),ISINSCOPE(Products[Category])),
DIVIDE(
    [TotalSales],
    CALCULATE(
        TotalSales,
        ALL(Products[Category])

)
),
DIVIDE(
    TotalSales,
    CALCULATE(
        TotalSales,
        ALL('Country'[CountryName])

)
)
    )

 

Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

WOW !! only a Kudo is not enough!!  Should be a Superkudo button.

 

Works like a charm... Thanks a lot!

Anonymous
Not applicable

Thanks @SandroRiz 

 

Glad i could help 😀

oh sorry, I left in the screenshot and I though it was visible.. anyway it is

% of total by country = DIVIDE([TotalSales], CALCULATE([TotalSales], ALL(Countries)))
 TotalSales is SUM(Sales[Amount])
 
(I know it is better to have ALLSELECTED() in case a slicer with countries was here...)
 
I attach Schema if it is useful...
Screenshot 2022-10-17 114051.jpg
Anonymous
Not applicable

Please check the edited messagem above

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.