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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
nickc_innova
Advocate I
Advocate I

Contexual Subtotal

Looking to have a measure return a sum that retains the context of a slicer but ignores the context of the row on a table visual. 
Here is a simple example table of data:

nickc_innova_0-1676935909558.png


Here is a simple table visual that intrinsically summarizes the values. With no Category filter applied the sum is 51. 

nickc_innova_2-1676935993262.png

Filter the table to Animals and Colors, and the new total is 29.

nickc_innova_3-1676936067933.png

 

I need a measure that will return these totals from the slicer but ignore the row-level context of the table visual. 

I tried variations on the following code:
DynamicSubtotal = 
CALCULATE(
SUM('Fact Table'[Values]),
ALLSELECTED('Fact Table'[Category]),
VALUES('Fact Table'[Category])
)

nickc_innova_6-1676936465225.png

nickc_innova_7-1676936583245.png

 


But I can only return the sum of all Categories ignoring the slicer, or all categories including the context of the slicer and the row. How do I keep the slicer context but not the row context?

Expected result:

nickc_innova_4-1676936267617.png

nickc_innova_5-1676936297659.png

 

Thanks in advance

1 ACCEPTED SOLUTION
nickc_innova
Advocate I
Advocate I

Nevermind, 
Solved it myself with the following code:

DynamicSubtotal =
SUMX(
CALCULATETABLE('Fact Table', ALLSELECTED('Fact Table'[Category])),
('Fact Table'[Values])
)

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@nickc_innova , Kudos to you

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
nickc_innova
Advocate I
Advocate I

Nevermind, 
Solved it myself with the following code:

DynamicSubtotal =
SUMX(
CALCULATETABLE('Fact Table', ALLSELECTED('Fact Table'[Category])),
('Fact Table'[Values])
)

Helpful resources

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

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.