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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
AndyB87
New Member

Measure for matrix visual that rolls up values from child rows to parent rows.

I'm trying to write a measure for a matrix visualization that will roll up a calculation of a percentage from child rows to parent rows. 

I have a data model with a fact table called 'retailSales' that contains transaction data and a dimension table called 'product' that contains product information. Our products are divided into a taxonomy of categories, so the product table has fields for [masterCategory], [category], and [subcategory]. I'm putting together an analysis of our product categories. I have a matrix where the rows drill down from master category to category to subcategory. I have a column that calculates dollar sales for each row. I'd like to write a measure that calculates each row's dollar sales value as a % of its parent row subtotal (and % of total sales for each master category). It should look like the following example:

AndyB87_1-1686848801908.png

 

So far, I have a measure that successfully calculates each row's % share of total sales, but it doesn't roll up percentages from child rows to parent rows the way I want. It calculates a child row as a % of the total rather than its parent. It looks like this:

 

CategoryShare = 
DIVIDE(
    SUM( retailSales[soldPrice] ),
    CALCULATE(
        SUM( retailSales[soldPrice] ),
        ALLSELECTED( product )
    )
)

 

 

Any thoughts on how to write a measure that does what I'm looking for?

1 REPLY 1
some_bih
Community Champion
Community Champion

Hi @AndyB87 try to use ALLEXCEPT for your column (I guess [category],) as shown in example https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/  I hope this help





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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