Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I would like to calculate a subtotal using dax (not using the subtotal feature of matrix visual)
Sample data:
| Client | Shop | Sales |
| A | 1 | 100 |
| A | 2 | 200 |
| B | 3 | 400 |
| B | 4 | 500 |
Desired outcome:
I want a measure that can calculate Client total for the displayed Shop without adding the client field itself to the visual
| Shop | Client Total |
| 1 | 300 |
| 2 | 300 |
| 3 | 900 |
| 4 | 900 |
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?
Solved! Go to Solution.
@Credo Please try this as a "New Measure"
Test107 = CALCULATE(SUM(Test107Measure[Sales]),FILTER(ALL(Test107Measure),Test107Measure[Client]=SELECTEDVALUE(Test107Measure[Client])))
Proud to be a PBI Community Champion
Add as measure
TotVal = CALCULATE(SUM(Table1[Sales]),ALLEXCEPT(Table1,Table1[Client]))
@Credo Please try this as a "New Measure"
Test107 = CALCULATE(SUM(Test107Measure[Sales]),FILTER(ALL(Test107Measure),Test107Measure[Client]=SELECTEDVALUE(Test107Measure[Client])))
Proud to be a PBI Community Champion
Thanks a lot
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 192 | |
| 125 | |
| 99 | |
| 67 | |
| 48 |