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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Credo
Helper I
Helper I

Calculate subtotal using dax

I would like to calculate a subtotal using dax (not using the subtotal feature of matrix visual)

 

Sample data: 

 

ClientShopSales
A1100
A2200
B3400
B4500

 

 

Desired outcome: 

I want a measure that can calculate Client total for the displayed Shop without adding the client field itself to the visual

 

ShopClient Total
1300
2300
3900
4900

 

Best I could come up with was 

CALCULATE(SUM('Table1'[Sales]); ALL('Table1'[Shop]))

 

but it just gives me a repeating 1200 across all shops as it should unless I add client field to the table.

 

How can I add filter context for the client into the measure if its not part of a visual? 

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@Credo Please try this as a "New Measure"

 

Test107 = CALCULATE(SUM(Test107Measure[Sales]),FILTER(ALL(Test107Measure),Test107Measure[Client]=SELECTEDVALUE(Test107Measure[Client]))) 

image.png





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

Proud to be a PBI Community Champion




View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Add as measure

 

TotVal = CALCULATE(SUM(Table1[Sales]),ALLEXCEPT(Table1,Table1[Client]))

PattemManohar
Community Champion
Community Champion

@Credo Please try this as a "New Measure"

 

Test107 = CALCULATE(SUM(Test107Measure[Sales]),FILTER(ALL(Test107Measure),Test107Measure[Client]=SELECTEDVALUE(Test107Measure[Client]))) 

image.png





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

Proud to be a PBI Community Champion




Thanks a lot

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors